P
Peter Stone
Novice
I have a combo box on the header of my form that selects travel
destinations. It worked fine until I changed the name of a field in the table
(and in the code).
Now when I try to select a destination in the combo box I get a compile error:
Method or data member not found
Please see the first Else statement below (I’ve indicated the problem in
capitals).
Thanks for the help
Peter
Private Sub cboDestination_AfterUpdate()
Dim resp, msg As String
Me.lstSelectRecord.Requery
Me.RecordsetClone.FindFirst _
"[LocalDestinationID] = " & Me![cboDestination]
If Not Me.RecordsetClone.NoMatch Then
'go to the first record in the set
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
'ask if they want to add a new record
msg = "No records. Do you want to add a new record?"
resp = MsgBox(msg, vbQuestion + vbYesNo, "Add Record")
If resp = vbYes Then
'go to a new record
DoCmd.GoToRecord , , acNewRec
PROBLEM BELOW, COMPILE ERROR CAN’T FIND LocalDestinationID
Me.LocalDestinationID = Me.cboDestination
Else
'go to the first record
DoCmd.GoToRecord , , acFirst
Me.cboDestination = Me.LocalDestinationID
End If
End If
Me.Refresh
End Sub
I have a combo box on the header of my form that selects travel
destinations. It worked fine until I changed the name of a field in the table
(and in the code).
Now when I try to select a destination in the combo box I get a compile error:
Method or data member not found
Please see the first Else statement below (I’ve indicated the problem in
capitals).
Thanks for the help
Peter
Private Sub cboDestination_AfterUpdate()
Dim resp, msg As String
Me.lstSelectRecord.Requery
Me.RecordsetClone.FindFirst _
"[LocalDestinationID] = " & Me![cboDestination]
If Not Me.RecordsetClone.NoMatch Then
'go to the first record in the set
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
'ask if they want to add a new record
msg = "No records. Do you want to add a new record?"
resp = MsgBox(msg, vbQuestion + vbYesNo, "Add Record")
If resp = vbYes Then
'go to a new record
DoCmd.GoToRecord , , acNewRec
PROBLEM BELOW, COMPILE ERROR CAN’T FIND LocalDestinationID
Me.LocalDestinationID = Me.cboDestination
Else
'go to the first record
DoCmd.GoToRecord , , acFirst
Me.cboDestination = Me.LocalDestinationID
End If
End If
Me.Refresh
End Sub