dlookup - no criteria

deekras

Registered User.
Local time
Today, 08:02
Joined
Jun 14, 2000
Messages
169
i keep a table of the last time certain queries are run. the table consists of 20 fields. each field is the name of a particualr query. Each field has only one record - the date of the last time it was run.

i want to get the date for a particular field (query). there really isn't a criteria. i just need that date.

i tried:

dlookup("terms","last_runs") but it doesn't work.

i get error msg "Syntax error in query expression 'terms'.
 
dlookup("[terms]","last_runs")

Name of the field must be in brackets.
 
Change your table structure to two fields (or three if you want an autonumber key)

The fields should be:


ID (if necessary)
QueryName - text
LastUsed - date/time

Then you obviously put your queries in the first field and your lastUsed time in the second.

The lookup then is simply:

=DLookup("LastUsed", "tblQueries", "QueryName = """ & strMyQuery & """")

This is better as it does what a database should do - grow downwards. Currently yours widens and if you create a new query you are going to go through the problem of having to add new fields (not to mention the fact yhat you currently have a problem).
 

Users who are viewing this thread

Back
Top Bottom