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
 
Look in help under domain aggregate functions. Specifically the DLookUp
function.
 
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 & "#")
===================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top