G
Guest
I'm using a combo box to lookup an account number in a table. The following
code is in the AfterUpdate event for the combo box:
Dim rsDistProfile As DAO.Recordset
If Not IsNull(Me.cboAccountNo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rsDistProfile = Me.RecordsetClone
rsDistProfile.FindFirst "[acct_no] = """ & Me.cboAccountNo & """"
If rsDistProfile.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rsDistProfile.Bookmark
Endif
Set rsDistProfile = Nothing
Finding the record is no problem. What I don't understand is why can't I
get values from the other fields in the record? When I try something like
this:
If rsDistProfile.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rsDistProfile.Bookmark
Me.contact_name = rsDistProfile!contact
code is in the AfterUpdate event for the combo box:
Dim rsDistProfile As DAO.Recordset
If Not IsNull(Me.cboAccountNo) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rsDistProfile = Me.RecordsetClone
rsDistProfile.FindFirst "[acct_no] = """ & Me.cboAccountNo & """"
If rsDistProfile.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rsDistProfile.Bookmark
Endif
Set rsDistProfile = Nothing
Finding the record is no problem. What I don't understand is why can't I
get values from the other fields in the record? When I try something like
this:
If rsDistProfile.NoMatch Then
MsgBox "Not found: filtered?"
Else
'Display the found record in the form.
Me.Bookmark = rsDistProfile.Bookmark
Me.contact_name = rsDistProfile!contact