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

Access

Status
Not open for further replies.

Pdugger

Technical User
Jan 22, 2007
2
US
I have a table within my database where I enter social security numbers for the purpose of keeping drug testing records. Within that database I have a table where I keep a list of drug testing failures. (tblTest) and (tblFailures). I have linked them with Social Security Number. I am trying to make a message box pop up if I enter a social security number in the tblTest that appears in the tblFailures telling me that they are not eligible for hire. I have tried conditional macros, and also tried validation text. I can't get it to work. Any suggestions?
 
How about;
Code:
rst.Open "Select * From tblFailures 
Where SSN = "' & txtSSN.Text & "'", Conn

If rst.RecordCount > 0 Then
   MsgBox "Drug addict - get lost."
End If

rst.Close


Have fun.

---- Andy
 
You may also consider the DLookUp function and the Cancel argument in the BeforeUpdate event procedure of your textbox.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top