473,652 Members | 3,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1895
-----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:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

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

iQA/AwUBREfvFIechKq OuFEgEQK/IgCgxZMvRbvICEi EkW7d2AHae5FhjW gAoLoi
ZpBWBs+DrAWgETt kiX1BdZBM
=x5e6
-----END PGP SIGNATURE-----
vu********@gmai l.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
3257
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 by a form. I created an update query called qryUpdate, which has both tblCustomers and qrySelect (linked by CustomerID). And I try to update one of the fields in tblCustomers. If I open the form, and I click on a button, I can open qrySelect and...
13
4220
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 solution here - until now. This one is driving me crazy. I am making my first attempt at creating a runtime application. I am using Access 2003 Developer Extensions. Initially I developed the database without planning on creating a runtime app...
6
3271
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 table, 200K rows, yearMonth is an indexed long integer the primary key is t_orno, t_pono
4
1881
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 way to create a single query that will take parameters if they are present in the text boxes and not take parameters if the text box is empty? The ten fields will need to be searched using "Like" so that the user can search on part of a text...
1
10476
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 passed to the query from a form (DateFrom and DateTo). When I open the form and populate the variables (DateFrom and DateTo) then open the query it works fine. My problem is that I need to do this from VBA coding and pass the 2 parameters to the...
3
2058
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 parameters...." I have read many articles on the web about how to make a dynamic report based on a cross-tab query. But for some reason mine never works right. First, my saved query's criteria is the data in an open form's combo box. So the...
3
2694
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 a query with the parameters selected from the form. Let's say I have three fields in my query. ,, and On the design view of the query, I put these criterias on different lines so that it would be using the OR: =!!
6
6856
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 similar reports, but all with different sized Address text boxes. For the function to work, the report need to be open in design view, so that the Text Box Width can be "measured". The function is obviously called for each line of the query (about...
9
2771
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 from searching on the internet and books but the problem is when i run the command button "Export" it just only open the Blank Spreadsheet, no data at all that it came from my query named "HVACWindwardQuery" and there's an error on it...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.