By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,497 Members | 2,127 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,497 IT Pros & Developers. It's quick & easy.

selecting from a query using parameters from form fields

P: n/a
I have a listbox on a form that is selecting using named FinalQuery:

SELECT [FinalQuery].[Job No#], [FinalQuery].[Date Ordered],
[FinalQuery].[Misc#]
FROM FinalQuery;

Now I have a text field with a date on this form and I'd like to use
that date as the selection criteria, comparing to the [Date Ordered]...
how would I use a field with the WHERE clause?

WHERE [FinalQuery].[Date Ordered] >= ....

also when I use static dates in the WHERE:

WHERE ((([FinalQuery].[Date Ordered])>="01/01/98" And
([FinalQuery].[Date Ordered])<="02/01/98"));

I get Data type mismatch in criteria expression...

Apr 20 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use Form reference parameters in the query:

PARAMETERS Forms!FormName!ControlName Date;
SELECT...
FROM ...
WHERE [Date Ordered] >= Forms!FormName!ControlName

For absolute dates (sometimes called hard-coded dates) use the #
delimiter:

[Date Ordered] >= #1/1/98# And [Date Ordered] <= #2/1/98#

The above can be better written as:

[Date Ordered] BETWEEN #1/1/98# And #2/1/98#

To use the # delimiter the date has to be in USA date format:
month/day/year.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBREfvFIechKqOuFEgEQK/IgCgxZMvRbvICEiEkW7d2AHae5FhjWgAoLoi
ZpBWBs+DrAWgETtkiX1BdZBM
=x5e6
-----END PGP SIGNATURE-----
vu********@gmail.com wrote:
I have a listbox on a form that is selecting using named FinalQuery:

SELECT [FinalQuery].[Job No#], [FinalQuery].[Date Ordered],
[FinalQuery].[Misc#]
FROM FinalQuery;

Now I have a text field with a date on this form and I'd like to use
that date as the selection criteria, comparing to the [Date Ordered]...
how would I use a field with the WHERE clause?

WHERE [FinalQuery].[Date Ordered] >= ....

also when I use static dates in the WHERE:

WHERE ((([FinalQuery].[Date Ordered])>="01/01/98" And
([FinalQuery].[Date Ordered])<="02/01/98"));

I get Data type mismatch in criteria expression...

Apr 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.