'Find' code

Nic

Registered User.
Local time
Today, 03:05
Joined
Jan 15, 2012
Messages
47
Hi,
New to this site, and hope i may be able to source some help. Im a bit rusty on my code knowlege:
I have a form with a cmd button with the following code behind it:

Private Sub Find_Click()
Me.RecordsetClone.FindFirst "[RecordNo] = " & Me![FindNo]

If .NoMatch Then
MsgBox "Audit Code Incorrect"
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub

I get a compile error saying 'invalid or unqualified reference.
Basically, the intension is for an operator to input a number into txt box 'FindNo' and then press cmd 'find'. Then the appropriate record from the 'record source' table is displayed. Other txt boxes on my form have their control set to other fields in the table. Without the If statement, the code works, but hopfully the reason for wanting an if statement will be clear, but i cant make it work? Any suggestions greatly appreciated,

Many thanks,
 
Access cannot guess what the "." refers to unless you tell it - that's what the error message means. So use With , or type the full object reference before the "."
 
Hi,
Thanks for the reply - but im still struggling a bit. Would be grateful for a bit more guidance please. Let me know if you need any more info about my db or what im trying to acheive. But in summary, its simply a form that a user will use to locate a record in a table. they will type the desired record number in a txt box, then click find. If the number typed in the text box doesnt exist in the data set, then i want a message box to appear. Your assistance greatly appreciated,

Thanks,
 
spikepl was saying either add a With statement or use:
Me.RecordsetClone.NoMatch
 
Perfect!
Thanks for that, i knew it would be quite simple,
Many thanks
 

Users who are viewing this thread

Back
Top Bottom