Find Record using 2 fields in table

  • Thread starter Thread starter Sgwapt
  • Start date Start date
S

Sgwapt

I am new to programming in Access and need some help.

I have a table containing repair data for tools.
The primary fields are ToolNo as Text and LineNo as Interger (000) format.

What I am looking for is the method to use to find information in other
fields such as "Status" in the last record. Tried Dlookup, Dcount, DMax, etc
but having trouble because I am using 2 fields as the criteria to find other
fields values.

The intent is when a user enters a new repair and selects the Tool No, I
want the user to be prompted if previous repair in record table for the Tool
No selected is still pending or open they have to close that first to enter a
new record for said Tool No. Maybe I am just thinking to much...LOL

Thank you in advance for any help you can assist with.
 
Generic syntax for DLookup when using two fields as criteria (assumes both
fields are numeric):

DLookup("FieldToFind", "TableToUse", "Field1=1 And Field2=2")

or, if you're concatenating a variable (or other object) value into the
string:

DLookup("FieldToFind", "TableToUse", "Field1=" & Variable1 & " And Field2="
& Variable2)
 
Back
Top