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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a Message Box

Status
Not open for further replies.

egstatus

Programmer
Apr 14, 2005
143
US
Hi all,
I have created a form that is using a querry to seach for an employee number.
I want to be able to display a message box that says that the "employee number was not found" if the employee number entered is not in the database.

Where/how do I put the code to display the message box?

Thanks

Ed
 
If I'm understanding you correctly and you're using a recordset, try this.
If recordset.recordcount = 0 Then
MsgBox("employee number was not found")
End If
 
Thanks for the reply.

The form record souce is a querry. [Is that what you mean by a recordset?]

In which event to I put the code. Form Load?


Thanks

Ed
 
And is this form based on a Parameter query?If so, put on the On Open event of your form.

Or do you have a field in the form and a command button that runs this query
 
You can set it at the same event when the query executes

If me.recordsource.recordcount = 0
Msgbox "No records were found"
End if

Pampers [afro]
Just let it go...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top