The VB Code I posted only works with ACCESS 2000. Any older versions will not work.
Below will work in Access97.
DLOOKUP FUNCTION
INV is a table name: field1 = RecNum, field2 = InvNum, field3 = Description
SALES is a table name: field1 = RecNum, field2 = InvNum, field3 = Description
Make a form: form name is = SALES
Put code in: Event Procedure (on Exit)
Me.Description = DLookup("[Description]", "INV", "[InvNum]=forms!Sales.[InvNum]")
End Sub
Me.Description means put the lookup info into the field named Description and Me. Means on this form. (In this case is SALES)
Dlookup is the function name.
Description is the name of the field in the INV table that you want to get the information from.
INV is the name of the table to get the information from.
The first [InvNum] represents the name of the field in the INV table. This is how lookup knows which record to get the data from.
=forms!Sales.[InvNum]”) Points to the field in the form (Sales, in this case) to determine the information necessary to lookup the information in the other table.
-or- another example
=Dlookup(“[the name of the field that you want to get the information from]” , ”the name of the table that the field is in”,”[field name in lookup table that identifies your match] =forms!name of form your in.[field name in the form your in that you want to match]”)
…………………….your in^ ABOVE there must be a period before [field name