Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with findfirst command 1

Status
Not open for further replies.

snipesnab

IS-IT--Management
Oct 24, 2002
171
GB
I need some help with the code below: If no corresponding value is found between refvalue and the order
number - how can I make an if statement to say if no value can be found then print a message box.

Set myrs = CurrentDb.OpenRecordset("tbl facilities log", dbopendynaset)
myrs.findfirst "[order number] = 'refvalue'"
 
You can use NoMatch

eg.

myrs.findfirst "[order number] = '" & refvalue & "'"

If myrs.NoMatch Then
'Not found message
Else
'Found Code
End If

There are two ways to write error-free programs; only the third one works.
 
Hi,

I believe this will help you out. I am currently running something similar in the Before_Update event on a textbox.

If rs.NoMatch Then
' there was no match, warn the user
MsgBox "Warning! No match", vbOKOnly
cancel = True
Me!Acceptance.Undo

End If

HTH

Have A Great Day!!!,

Nathan
Senior Test Lead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top