Hi Connie,
rather than creating a new record in the code that opens the form, use OpenArgs to pass a parameter and test it
DoCmd.OpenForm "ListingsHomeInfo", , , "ListID=" & Me.ListID, , , Me.ListID
make sure ListID is a control on the form, even if its Visible property is False
on the Load event of the ListingsHomeInfo form, do something like this:
'~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Form_Load()
If Len(Trim(Me.OpenArgs)) > 0 Then
If IsNumeric(Me.OpenArgs) Then
Dim nListID As Long
nListID = CLng(Me.OpenArgs)
If Not Me.NewRecord Then
DoCmd.RunCommand acCmdRecordsGoToNew
End If
Me.ListID = nListID
End If
End If
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~
--- On Wed, 8/31/11, mrsgoudge wrote:
> I have a datasheet form. The
> join table it's based upon has three fields:
> ListingsHomeInfoID, ListID, and HomeInfoID. This is
> for situations where there is more than one HomeInfoID per
> ListID. It is opened with a button which uses a where
> condition for the ListID.
>
> Here's the code for that button:
> DoCmd.OpenForm "ListingsHomeInfo", acFormDS, , "ListID = "
> & Me.ListID
> DoCmd.GoToRecord , , acNewRec
> Forms!ListingsHomeInfo.ListID.Value = ListID
>
> On the form there are several columns which all use
> comboboxes:
> OtherParcelNbr and Address have HomeInfoID as their Control
> Source; PropertyName, AddressCity, MainParcelNbr and
> ListID have ListID as their source. When something
> with HomeInfoID as its control source is entered the other
> column automatically fills in. The same with the
> ListID boxes.
>
> I have BeforeUpdate code on all of them to prevent users
> from inadvertently changing something. This results in
> a Yes/No Message box asking if they really intended to
> change the data. If Yes is clicked the new info is
> retained. If No is clicked it reverts to the old
> data.
>
> The PROBLEM is that when No is clicked, I get one of two
> messages--"Property Not Found" (when ListID, MainParcelNbr
> or OtherParcelNbr is changed) or "No current record" (when
> Address, PropertyName, or AddressCity is changed).
> These messages have no error code number, have a yellow
> triangle with an exclamation point, and Ctrl Break does not
> result in anything. I've done a find in the code for the
> project and neither of these two phrases was found.
>
>
> Help!
> Connie (Thanks too :-) )
>
>
Rabu, 31 Agustus 2011
Re: [MS_AccessPros] "No Current Record" Or "Property Not Found"
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar