Dlookup Issue in Query Criteria

G

Guest

Hi All,

My Problem seems pretty simple but i just dont seem to be able to get my
head round it.
I am trying to use Dlookup in a query criteria to find a specific number
from a table dependent on todays date as the lookup reference.

DLookUp("Date()","[Vehicensus DaysTbl]","[Tuesday]")

My table has a list of dates on the far left and 4 other columns, 1 being
"Tuesday".
I was hoping it would be able to find todays date in the table using
"Date()" and return the value from "Tuesday" in the criteria.

All suggestions would be greatfully recieved but i know about as much about
sql as i do rocket engineering, so if you could keep it resonable simple
would be amazing!

Thanks v much!
Dave
 
T

Tom Lake

Dave K said:
Hi All,

My Problem seems pretty simple but i just dont seem to be able to get my
head round it.
I am trying to use Dlookup in a query criteria to find a specific number
from a table dependent on todays date as the lookup reference.

DLookUp("Date()","[Vehicensus DaysTbl]","[Tuesday]")

The first parameter should be the name of the field whose value you're
looking for.
There's no field in the Vehicensus DaysTbl named Date().
My table has a list of dates on the far left and 4 other columns, 1 being
"Tuesday".
I was hoping it would be able to find todays date in the table using
"Date()" and return the value from "Tuesday" in the criteria.

You can only search one column per DLookup. What column (field) would you
like to search?
If it's called Monday, you can do this:

DLookUp("[Tuesday]","[Vehicensus DaysTbl]","[Monday] = #" & Date() & "#")

This will return the value in the field Tuesday that corresponds to the
field Monday which has today's
date in it.

Tom Lake
 
G

Guest

The DLookUp
DLookUp("[FieldName]","[TableName]","[Criteria]")

I don't understand why you are using DLookUp to look for todays date, just
use Date(), that will return the current date.

If you want to return a value from a table, when the filer will be the
current ate
DLookup("[Tuesday]","[Vehicensus DaysTbl]","[FieldName] = #" & Date() & "#")
 
G

Guest

Your a *STAR* Ofer!

Thanks a lot!
Davey

Ofer said:
The DLookUp
DLookUp("[FieldName]","[TableName]","[Criteria]")

I don't understand why you are using DLookUp to look for todays date, just
use Date(), that will return the current date.

If you want to return a value from a table, when the filer will be the
current ate
DLookup("[Tuesday]","[Vehicensus DaysTbl]","[FieldName] = #" & Date() & "#")

--
\\// Live Long and Prosper \\//


Dave K said:
Hi All,

My Problem seems pretty simple but i just dont seem to be able to get my
head round it.
I am trying to use Dlookup in a query criteria to find a specific number
from a table dependent on todays date as the lookup reference.

DLookUp("Date()","[Vehicensus DaysTbl]","[Tuesday]")

My table has a list of dates on the far left and 4 other columns, 1 being
"Tuesday".
I was hoping it would be able to find todays date in the table using
"Date()" and return the value from "Tuesday" in the criteria.

All suggestions would be greatfully recieved but i know about as much about
sql as i do rocket engineering, so if you could keep it resonable simple
would be amazing!

Thanks v much!
Dave
 
G

Guest

Glad I could help, Good luck

--
\\// Live Long and Prosper \\//


Dave K said:
Your a *STAR* Ofer!

Thanks a lot!
Davey

Ofer said:
The DLookUp
DLookUp("[FieldName]","[TableName]","[Criteria]")

I don't understand why you are using DLookUp to look for todays date, just
use Date(), that will return the current date.

If you want to return a value from a table, when the filer will be the
current ate
DLookup("[Tuesday]","[Vehicensus DaysTbl]","[FieldName] = #" & Date() & "#")

--
\\// Live Long and Prosper \\//


Dave K said:
Hi All,

My Problem seems pretty simple but i just dont seem to be able to get my
head round it.
I am trying to use Dlookup in a query criteria to find a specific number
from a table dependent on todays date as the lookup reference.

DLookUp("Date()","[Vehicensus DaysTbl]","[Tuesday]")

My table has a list of dates on the far left and 4 other columns, 1 being
"Tuesday".
I was hoping it would be able to find todays date in the table using
"Date()" and return the value from "Tuesday" in the criteria.

All suggestions would be greatfully recieved but i know about as much about
sql as i do rocket engineering, so if you could keep it resonable simple
would be amazing!

Thanks v much!
Dave
 
J

John Vinson

On Thu, 5 Jan 2006 13:31:03 -0800, Dave K <Dave
Hi All,

My Problem seems pretty simple but i just dont seem to be able to get my
head round it.
I am trying to use Dlookup in a query criteria to find a specific number
from a table dependent on todays date as the lookup reference.

DLookUp("Date()","[Vehicensus DaysTbl]","[Tuesday]")

This will attempt to look up today's date from the table where the
field [Tuesday] contains TRUE. It makes no sense, sorry!
My table has a list of dates on the far left and 4 other columns, 1 being
"Tuesday".

If you have a field named Tuesday, your table structure is almost
certainly wrong.
I was hoping it would be able to find todays date in the table using
"Date()" and return the value from "Tuesday" in the criteria.

Then you have it backwards. The first argument is the value which will
be returned from the table; the second argument (which you have
correct) is the name of the table or query; the third argument is a
valid SQL WHERE clause without the word WHERE. If your "extreme left"
field is named Datelist, try

=DLookUp("[Tuesday]", "[Vehicensus DaysTbl]", "[Datelist] = #" &
Date() & "#")

The # is a required delimiter for Date/Time fields.

John W. Vinson[MVP]
 

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

Similar Threads

Dlookup Issue in Query Criteria 2
Conditional Criteria 4
IS this DLOOKUP possible within a query? 4
Using IIF In Query Criteria 4
Dlookup in query 1
DLookup in a Query 2
DLookup Problem 2
Query criteria problem 2

Top