473,326 Members | 2,114 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,326 software developers and data experts.

How to Pull All as well as specific data

I have a query that is supposed to pull data from the table based on the unit that is selected from a combo box on a form. I have the query pulling a specific unit but I want the user to be able to pull all units if they select "ALL" from the combo box. How do I do this?
For example:
Units can be 1w, 2w, 3w or All.
The user selects 1w on the form and the query pulls all data for the unit 1w. When the user selects All, instead of pulling all data for all units it pull nothing.

The criteria in the query is
Criteria: [Forms].[ProgramFS]![cboUnit]
Oct 2 '07 #1
3 2066
I have a query that is supposed to pull data from the table based on the unit that is selected from a combo box on a form. I have the query pulling a specific unit but I want the user to be able to pull all units if they select "ALL" from the combo box. How do I do this?
For example:
Units can be 1w, 2w, 3w or All.
The user selects 1w on the form and the query pulls all data for the unit 1w. When the user selects All, instead of pulling all data for all units it pull nothing.

The criteria in the query is
Criteria: [Forms].[ProgramFS]![cboUnit]
a couple questions. How are you filling the items in the combo box (1w, 2w, 3w, all)? Is it via code or is it pulling from a table? For your current question, a sufficient answer may depend on that.

One of the things that you could do is just add a command button to your form near the combo box that says "pull all units" or something like that. Then code the button to either pass a "*" wildcard through your query, or set it up to run on a separate query that pulls all data.
Oct 2 '07 #2
a couple questions. How are you filling the items in the combo box (1w, 2w, 3w, all)? Is it via code or is it pulling from a table? For your current question, a sufficient answer may depend on that.

One of the things that you could do is just add a command button to your form near the combo box that says "pull all units" or something like that. Then code the button to either pass a "*" wildcard through your query, or set it up to run on a separate query that pulls all data.

I have a value list in the combo box. I would set up another query to pull all but there are about twenty queries that use the same data on this form, specifically the unit. I would have to create a an additional query for each type of the existing ones just to pull all units. I was hoping there was a way to pass a "*" through the query. How do I do this?
Oct 4 '07 #3
I have a value list in the combo box. I would set up another query to pull all but there are about twenty queries that use the same data on this form, specifically the unit. I would have to create a an additional query for each type of the existing ones just to pull all units. I was hoping there was a way to pass a "*" through the query. How do I do this?

I was able to figure out the problem. I changed the Criteria for the field to

Criteria: IIf([Forms].[ProgramFS]![cboUnit],[Forms]![ProgramFS]![cboUnit],Null)

and added an additional field

Field: [Forms]![ProgramFS]![cboUnit]
Criteria: ="*"

Works Beautifully!
Oct 4 '07 #4

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

Similar topics

5
by: Julia Baresch | last post by:
Hi everyone, I haven't found any reference to this problem on this group or in Access 97 help. I hope someone here knows this - probably a simple thing, but not obvious. I designed a query to...
2
by: Scott Baird | last post by:
HELP!!! I've got a DB with two tables (relationships with a autonumber). The database works just fine, but I've got a report I simply can't make work. I've made a query that uses data from...
3
by: Tommy | last post by:
My recent project contains such kind of requirnment, we display the data in a datagrid, and frequently, the underlying data is subjected to change. We want to implement a 'pull model' website which...
1
by: David Lozzi | last post by:
It use to be so easy in ASP, but now in ASP.NET i'm lost and confused. I'm trying to connect to a SQL database, open a table via a SQL string. Then take the returning recordset and do what I want...
2
by: Nick | last post by:
What I want to do is have 2 pull down lists, for example a state pull down list and a city pull down list. What I would like to have done is when you select a state from the state pull down list...
4
by: sparks | last post by:
We have a new project here, one that I have never tried maybe its easy I don't know yet. We have people that have records dating back over 5 yrs on a sql server. We have to build an access 2003...
1
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. ...
5
by: giandeo | last post by:
Hello Experts. Could you find a solution for this problem please! I have the following tables in Access Database Table Name: origin Fields Names: country, countrycode Table Name: make...
5
by: Yarda | last post by:
Hello, I am new to php and databases, we have an intranet and I have installed apache, mysql and php. We want to index, catalog and serve mp3 files from a web page using the above mentioned...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.