473,388 Members | 1,207 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,388 software developers and data experts.

Using combo box to submit criteria to query?

I have a query that queries the work order table by date. I want to be able to query by last 30, 60, or 90 days.

I'm using a combo box on my main form to select 30, 60 or 90 days. The bound column for the combo box should return
Expand|Select|Wrap|Line Numbers
  1. >= Date()-30
Expand|Select|Wrap|Line Numbers
  1.  >= Date()-60
or
Expand|Select|Wrap|Line Numbers
  1. >= Date()-90
depending on which one is selected.

I have the following code for the after update event for the combo box:

Expand|Select|Wrap|Line Numbers
  1. Forms![frm_Main].[sfrm_WO_Query_Results].Form.Requery
When I open the form I get the following error:

"the expression is typed incorrectly or it is too complex to be evaluated..."

If I type the criteria directly into the query it works fine.

I tried eliminating the combo box as a part of the problem by closing the form and entering the criteria at runtime. However, I get the same error.

Access seems to have a problem receiving criteria in the form of an expression from a comba box.

Is this possible and I'm just missing something?

Thanks in advance.
Jan 15 '11 #1
1 1732
Problem solved. I changed the query criteria to >=Date()-[Forms]![frm_Main]![cbo_Date_Range] and pulled the number of days instead of the entire expression.
Jan 15 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Cillies | last post by:
Hi! I have a form that displays information using DLookUp. Now at present I am going into the query and entering criteria that I want the form to display. i.e. the form is for a sports team and...
1
by: Cillies | last post by:
Does any one know if it is possible to search a database by using combo boxes from a form. I have a form which includes comboboxes. I want to know If I can use these combo boxes to search, i.e....
8
by: Bri | last post by:
Greetings, I am using Eval() in a query with only limited success. If the text within the function contains a reference to a Field I get #ERROR#. I'll try and explain what I'm trying to do and...
1
by: Dave | last post by:
I have a web page with a text box and a query box that submits a query to a database that fills a datagrid. I want the enter key to submit the query - sof far I haven't found a method to it. ...
11
by: DP | last post by:
hi, i have a films table and form. i have a txt field in teh form called txtSearch , and i;ve created a query with all the film table fields in it. how can i get the query to load up, wth the...
1
by: Jim | last post by:
I have a form with a combo that is linked to another query. It's my way of getting a value that I need displayed on the form. Only problem is the value isn't there until I select the combo...
4
by: torontolancer | last post by:
Hi there how r u .I would really appriciate ur concern regarding checking out this code. its beind a command button and i am have a combo box selecing a query criteria and then pressing the button...
1
by: jyotig | last post by:
hi, i am using combo box for company list in ms-access but if new company name will come that time i am going to table and add new company and again open form and select that company. there is...
2
by: ganesandeiav | last post by:
Dear sir how to retrieve a data that has been selected using combo box using jsp
0
by: bala venkata siva ram kum | last post by:
hi I want autocompletetextview in android here we are using sqlite database with query using cursor. public void cal() { SQLiteDatabase db= null; String TableName = "enquiryhead"; db...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
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
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...

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.