vba help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

so, i'm in a data entry form. i enter in some data and i press ok. in the
okButton_Click event i need to goto 2 other tables inside the same database
to do some checking before the record is added.

Can someone please help with the syntax to goto to those table and retrieve
the info i need to validate the new record?

thanks,
rodchar
 
Use the Dlookup to retrive the data from the tables

To retrieve a field where the filter you are using is number type
Dlookup("FieldName",TableName","FieldName = " & Param)
===================
To retrieve a field where the filter you are using is string type, will
include a single quote before and after the param
Dlookup("FieldName",TableName","FieldName = '" & Param & "'")
===================
To retrieve a field where the filter you are using is date type, will
include the # before and after the param
Dlookup("FieldName",TableName","FieldName = #" & Param & "#")
===================
 
thanks for the help as always.

Ofer said:
Use the Dlookup to retrive the data from the tables

To retrieve a field where the filter you are using is number type
Dlookup("FieldName",TableName","FieldName = " & Param)
===================
To retrieve a field where the filter you are using is string type, will
include a single quote before and after the param
Dlookup("FieldName",TableName","FieldName = '" & Param & "'")
===================
To retrieve a field where the filter you are using is date type, will
include the # before and after the param
Dlookup("FieldName",TableName","FieldName = #" & Param & "#")
===================
 
Back
Top