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!

Querying data from a form

Status
Not open for further replies.

load3d

Programmer
Feb 27, 2008
117
US
When entering data on an Access form, on field change, I want to check to make sure that the data in the field does not match data in an Access query. If the data entered in the form matches a record in the query than I want to throw up a message. (I know how to do messages). I'm learning, please help.

 
Have a look at the DLookUp function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the prompt reply. I think this will work once I learn how to use it. As of right now, every time I try and save the record it is throwing up the message.

Dim strservice

strservice = DLookup("[Machine#]", "OutOfService", "[Machine#]= '" & [Forms]![frm_checkinOut]![Assettag] & "'")

If strservice = "1" Then

errmsg7 = MsgBox("This machine is out of service please select another machine", vbOKOnly, "Out Of Service")
Me.Assettag.SetFocus
 
I figured it out. Thanks for your help! I can finally move on to another project.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top