marco condition

G

Guest

I wanted to run my update query base on the the record count of my table.
Is it possible to be done using condition marco?

I have my query like

"SELECT COUNT(*) FROM MYTABLE"

I wnated to run my update quesry base on this select query.

Any informaiton is great appreciated,
 
K

Ken Snell [MVP]

You want to run the update query based on how many records are in the table?
Use the DCount function:
DCount("*", "MYTABLE")

It returns the number of records in the table. If there are no records, it
returns a value of 0.
 
G

Guest

Thanks for the informaiton,
Can I compare a field data not on the form?
For example,

Can I use
Mytable.Myfield = date() as a condition?

Thanks again,
 
K

Ken Snell [MVP]

Not directly, but you can use the DLookup function to get the value from a
field in a table; but if MyTable has more than one record, you'll need to
also provide a criterion expression to tell DLookup which record to get. See
Help file for more details, and post back if you have questions.
 

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

Top