473,386 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

selecting from a query using parameters from form fields

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
1 1886
-----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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Nicolae Fieraru | last post by:
Hi All, I was trying to update a field in a table, based on the results from a query. The table to be updated is tblCustomers and the query is qrySelect. This query has two parameters, provided...
13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
6
by: lesperancer | last post by:
SELECT distinct b.t_orno, b.t_pono FROM tblMonthlyBooking AS b, tblFilterDate, tblFilterDate AS tblFilterDate_1 WHERE (((b.t_yearMonth) Between . And .)); tblMonthlyBooking is a sql server...
4
by: DeanL | last post by:
Hi Guys, I need some help creating a query that is going to take between 1 and 10 parameters. The parameters are entered on a form into text boxes that may have data or be empty. Is there a...
1
by: Mayhem05 | last post by:
I have an Access 2003 database that I need to write some VBA code for to populate a table. The table is based on a query I have built in Access queries. Right now I have 2 parameters that are...
3
by: Richard Hollenbeck | last post by:
I am very sorry about the (almost) re-post, but you will see that my first question wasn't very clear; I have another question I posted this morning called, "in DAO: Run time error 3061 Too few...
3
hyperpau
by: hyperpau | last post by:
Hi there guys! I have a Form where there are three comboboxes. This comboboxes are used as references for the parameter of 3 fields in a query. when I hit a command button in my form, it opens...
6
by: Phil Stanton | last post by:
I am running a query that calls a function used to format addresses depending on the width of a control on a report that shows that address. The same query is used as the RecordSource of lots of...
9
by: QCLee | last post by:
Sir can you help me to transfer my Access Query to MS excel? i have a command button on the form to export the parameter query named "HVACWindwardQuery" to excel spreadsheet and i got the codes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.