I am having trouble with a very simple task. I have a form that is opened in "add mode". The user enters the customers account number (same is the customer ID primary field) and I want it to lookup if the account number already exists in the underlying query and if so then navigate the form to that record, and if not jsut continue in add mode. This is what I have so far but cant get to work right...
With the above code rs.nomatch always returns true when in fact there should be a match in my testing. What could I be missing. Can it have something to do with the form being opened in "add mode"? Can the Set rs = Me.RecordsetClone be setting the recordset to an empty recordset?
Code:
Private Sub CustomerID_AfterUpdate()
'Check if the customer being entered is currently in the list...
If DLookup("[Charge ID]", "[Recurring Charges]", "[Customer ID] =" & Me.CustomerID) > 0 Then
If MsgBox("The selected Custome is already set up for recurring charges. Would you like to view their current info?" & Chr(13) _
& "Click Yes to view existing or No to enter a new recurring charge for this customer.", vbYesNo) = vbYes Then
Dim rs As Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[Customer ID] =" & Me.[Customer ID]
If rs.NoMatch Then MsgBox "error" 'random error msg used here for debugging
'Undo the entry of the customer...
Me.Undo
'navigate to the record that matches
Me.Bookmark = rs.Bookmark
Else
Exit Sub
End If
End If
End Sub
With the above code rs.nomatch always returns true when in fact there should be a match in my testing. What could I be missing. Can it have something to do with the form being opened in "add mode"? Can the Set rs = Me.RecordsetClone be setting the recordset to an empty recordset?