question on dlookup

G

George Applegate

If I have a table filled with records of days, say
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
and I have a query that has a select that it only include records
where the day entered exists in the table, i.e. by doing DLOOKUP, is
that a valid way to validate data entered?

For instance, so someone doesn't inadvertently enter "Sunderday", or
Thuesday".

Does that make sense? I want to validate that it only pulls in
records in my other transaction table that have valid days entered.

Or a variation. Let's say I have a table that has dates in it:
01/02/2008
01/03/2008
01/04/2008

Can I use a Dlookup to in a query select to only include records that
have dates taht match the dates in the date table file?

Just wondering if Dlookup would work for this.

thanks,
ga

George Applegate
[email protected]
 
A

Arvin Meyer [MVP]

DLookup returns a single value. If you want to return records withing a
specified range, build a recordset.
 
J

John W. Vinson

and I have a query that has a select that it only include records
where the day entered exists in the table, i.e. by doing DLOOKUP, is
that a valid way to validate data entered?

For instance, so someone doesn't inadvertently enter "Sunderday", or
Thuesday".

Does that make sense? I want to validate that it only pulls in
records in my other transaction table that have valid days entered.

Well... this may be a hypothetical example, but rather than making users type
in something from a restricted list of options, and slapping their hand if
they make a mistake, why not just give them a Combo Box or Listbox and let
them select from the list of valid values??
 
T

Tom van Stiphout

On Thu, 25 Dec 2008 20:46:22 -0600, George Applegate

A better and more standard way would be to use a combobox rather than
a textbox. That way the user can only choose valid days or dates.

-Tom.
Microsoft Access MVP
 
Top