Selecting Query Criteria From A Combo Box.. Please Help!!!

May 17, 2007

Hi all

I am trying to get my head around some of the more advanced “features” of access..

At the minute I am trying to change the criteria of a query from selecting a value from within a combo box.. I believe I have got the syntax correct, but I keep getting no results returned..

I am using:
[forms]![frmMovies]![combo2] as the criteria where frmMovies is the name of the form, and combo2 the name of the combo box.. I have set combo2’s source as the table containing the movie information “tblMovies”
Before you ask I am not trying to setup my own movie store, more apply the theory to a bigger DB that I am working on :-p

Hopefully you can help, as I have now been scouring the forums for 2 days and am getting no where..

Thanks in advance

Noel

View Replies


ADVERTISEMENT

Selecting Criteria In A Query

Jan 22, 2006

Hi, I'm a complete novice to Access and wonder if anyone can help me with this one please? I have a column in a query that is the output from a barcode scanner called WhenScanned from a table tblScans. The data in the column is in the format of the date and time for example: 20/01/2006 21:30:00 I want to be able to interrogate the data in the query by selecting a range of a date(s) and times for example from 20/01/2006 05:30:00 to 20/01/2006 13:29:00, date and time range from 13:30:00 to 21:29:00, date and time range from 21:30:00 to next day 05:29:00. I can achieve this by typing the required range into the criteria row of the query column in design view e.g. >=#20/01/2006 13:30:00# And <=#20/01/2006 21:29:00# for each range but I want to make it more user friendly so that a user can select type in the appropriate date and select the time range from a drop down list or something without having to edit the query using syntax. Thanks in anticipation.

View 2 Replies View Related

Selecting Two Items For Query From Combo Box

Jul 22, 2015

I have a combo box that has three items in it. Name, ID_Num, Date

I need to use ID_Num and Date to filter the results of query. I can use one or the other but not both. I have tried ListIndex but apperently am writing it wrong in the expression builder.

[Forms]![TableName]![Combo0].

[ListIndex]????????????

I have tried =0, =1, =2 after the

[ListIndex] but it doesn't work.

How do I use two items from combobox in a query?

View 2 Replies View Related

Setting Query Criteria To Be 'blank' Depending On The Criteria Of A Combo Box

Oct 21, 2006

I have set up a database that stores actions (i.e jobs). In the table; two of the fields are...'required completion date' and 'actual completion date'. I wish to lookup, by using a query, all of the open actions (those which havent yet been complete (i.e the 'actual completion date' is null)) and then later on all those which are overdue (i.e the 'actual completion date' is null And the 'required completion date' <today....this being the criteria for an overdue action).

However, I have used a form which has a combo box which contains the values open and overdue. When a selection has been made I want a form to display with the results depending on the selection that has been made. I am capable of creating a form based on a query, but am unsure of how to construct the query with the correct criteria based on the option that is selected from the form.

Any help would gratefully be appreciated. Thanks

View 5 Replies View Related

Display Records Of Select Query After Selecting Desired Data From Single Combo Box

Nov 13, 2011

I created a subform that displays the records of a select query after selecting the desired data from a single combo box (for instructors name) and then using an OpenQuery macro attached to a button.

Only 1 record is displayed in the subform each time I hit the button. If I look at the query return there is no change. However, if I close the query and select a new instructors name, although I only get one record in the subform, the query when opened shows all the correct records.

What is wrong with my macro/subform?

View 8 Replies View Related

Combo Box For Query Criteria

Sep 14, 2006

Is it possible to use a drop down combo box to specify criteria?

I have a query which asks to select a name ( Criteria [Enter Name] ). What I want is to be able to select from a list of names available.

I create my queries using the Wizards, so specific SQL to enable the above would be appreciated if there is not a straight forward solution.

Thanks

Richard

View 3 Replies View Related

Query Criteria From Combo Box

Jul 13, 2015

I have two combo boxes.

My first combo box has the options:

Calendar
Off Calendar

If "Calendar" is selected, I would like to click a button that runs query1 with this criteria: "Like "*" & "12/31" & "*" AND "*" & Forms!MyForm!cbo2"

Example:

If "Off Calendar" is selected, I would like to click the same button that runs query1 with this criteria: "Not Like "*" & "12/31" & "*" AND "*" & Forms!MyForm!cbo2"

Example:

I'm having trouble setting this up...

View 14 Replies View Related

Union Queries And Selecting Fieldnames With Criteria

Oct 18, 2006

I am trying to combine fields (different columns) into one field. However I am trying to have a criteria for the fieldname. For example I wish only to combine the columns that contain the text 2003 (ie [Value 2003],[Price 2003]). I have tried to use wildcards in SQl ie select * from [query] where * = %2003. I must be missing something because I can't seem to work it out. It must be simple. I have also tried several ways through the design grid with wildcards in expressions. I also don't want to union the columns by using the exact names ie [Value 2003]& [Price 2003] because additional columns may be added.

Any help, extremely appreciated, I have wasted a whole day with this.

Deesy.

View 4 Replies View Related

Selecting Records Based On Multiple Criteria

Jul 10, 2007

hi,

i am querying a single table that contains card numbers and corresponding transaction codes (amongst other things). a single card number can have multiple transaction codes.

i want to select all card numbers that have both 0100 and 0802 transaction codes.

if i use a select query with ="0100" Or "0802"as the criteria, it returns all card numbers that have either 0100 or 0802 transaction types. if i then change the query to crosstab and group by card number, it is clear that some cards have both transaction types.

when i try to change the criteria to ="0100" And "0802" it returns nothing at all.

i'm sure the solution is something really simple - any idea what i'm doing wrong?

View 7 Replies View Related

Query Criteria From Combo Box On Form

Dec 21, 2005

I can't figure out what I am doing wrong... I want the query criteria to be defined by a combo box in the form. The user will select the criteria on the combo box, then click a button to run the query, however the query keeps coming up blank.

[Forms]![UserReview]![Staff] is what I have entered in the criteria for the field in the query. If I simply type in "casbds1" as the criteria, which is one of the choices in the combo box, it returns with the data I want, but I just can't get it to work with the combo box. Any ideas what I am doing wrong?

View 1 Replies View Related

Using A Combo Box Selection For Query Criteria

Nov 1, 2006

I have a report that is based on a query. In the query, I have a field called "Mode". In the criteria section for the Mode field, I am calling the selection from a combo box on a form called "frm_main". So the criteria for the Mode field is "[Forms]![frm_Main]![Mode_ComboBox]". This combo box has selections for 1,2,3,4,5. I want a selecton on the combo box that will work with the query to show all modes. Sometimes something weird gets entered into the database like "NoMode" for example. I have tried adding a combo box selection of "*" , "Is Not Null" and "". If I manually type these into the criteria section of the query, it works fine. But when I use these in the combo box and call the combo box selection from the query, it does not work.

Does anyone have any idea what I can use in my combo box selection that when selected, the query (and hense report) will show all data?

Thanks,
Jim

View 5 Replies View Related

Multiple Criteria Query Using Combo Boxes

Jan 28, 2008

Hi All,

I am currently having problems with a multiple criteria query with combo boxes (see attached file).

The problem:

- When user defines all 3 criteria (e.g. selects Project: A, Category: Services and Equipment Type: Packages), the query returns a result - no problem here.

- When user defines no fields (i.e. all combo boxes empty), query returns all records - again, not a probelm.

- However, say a user wants to display all records belonging to just Project: A, for example, the query returns no records. Obviously, there a a number of combinations of this (another example would be a user wanting to show records from project: B, with Category: Equipment Type).

I have included the Is Null statement in the query but to no avail. Could anyone advise on a solution based on the attached database. Your help would be greatly appreciated!

Kind regards,

Stephen

View 2 Replies View Related

Combo Box Relating To Variable Criteria In Query

Mar 16, 2006

I have an unbound Combo Box in a form that I would like to use to set criteria in the query. How do I do this?

View 1 Replies View Related

Combo Box Relating To Variable Criteria In Query

Mar 16, 2006

I have an unbound Combo Box in a form that I would like to use to set criteria in the query. How do I do this?

View 2 Replies View Related

Value In Text Box As Criteria For Query Which Populates Combo Box

Oct 25, 2006

Simple question but I've been stuck for a looong time.

So what I want to do:

1. enter a value into a text box (Home_Tel) in a form (frmStudentClass)
2. which runs a query (qryNameTel)
3. and return the results to a combo box (Student_Name) on the same form.

The same Home_Tel may have several Student_Name results.


-I have entered
[Forms]![frmStudentClass]![Home Tel]
for the criteria in the query
- However I can't get the results to turn up on the combo box
- I have the following:

Private Sub Home_Tel_AfterUpdate()
' run query
DoCmd.OpenQuery "qryNameTel"

Me.Student_Name.Requery

End Sub



Any ideas?


Or is there an easier way to tackle the problem?


Home_Tel and Student_Name are from the same tables.
I have created a query just for Home_Tel and Student_Name



Thanks everyone!

View 1 Replies View Related

Problem Using Combo Box As Query Filter Criteria

Mar 20, 2006

I have a two combo boxes that I want to use to help filter a query. The field the combo boxes need to filter is a numeric field with values that range anywhere from 200 to 1.5 million. To make the filtering easier I set the combo box up to several values (RowSource = Value List) that will serve as a range.

It seems that the query is not recognizing the values selected in the combo box. The numbers appear after being selected, but the query is not affected by the selection. However, When I enter a number NOT on the list (like 428) the query recognizes the value.

How can I get the query to recognize the Value List entries on the combo box?

View 1 Replies View Related

Combo Box Relating To Variable Criteria In Query

Mar 16, 2006

I have an unbound Combo Box in a form that I would like to use to set criteria in the query. How do I do this?

View 3 Replies View Related

Queries :: Using Combo Box To Input Criteria Into Query

Jul 26, 2013

I have a customers list that i am always ading to .I need to run a query to see what individual customers have ordered .

I have the query that works great when i manually insert the customers Surname .but i want the combo to do this job .Is it possible ,or should i be doing something different .

View 1 Replies View Related

Queries :: Using Part Of Date As Query Criteria From Combo Box?

Apr 4, 2013

I have a query with a date field that is formatted mm/dd/yyyy. I have a combo box that is formatted as mm/yyyy. I need the choice from the combo box to be the criteria for the date field in the query. the combo box has to contain the month and year only (which it does now) and the query must return mm/dd/yyyy. I have tried a few statements and the closest I got was a between statement that added 30 days to the combo box selection but that's not really accurate.

View 2 Replies View Related

General :: Query To Show Textbox If Combo Box Criteria Is Met

Jul 13, 2013

Is it possible in access 2010 to create a a query that only shows a text box if a combo box criteria is met?

Example: On a form there is a combobox (Result) that can either be negative or positive. If the value is Negative then a query is already setup that populates a mailmerge with some text. If Results=Positive can a query be created that will show the textbox (Data). It only needs to show if the positive criteria is met.

View 6 Replies View Related

Queries :: Use Switch In Query Criteria Based On Combo Box

May 15, 2013

On I form I have a combo box called cboMobileStatus.Its row source type is "Value List".The row source is: 1;" All";2;"Has";3;"None".I have a query based on table "tblCustomerContacts" and I want to limit the records returned based on the value of the combo box.So if the user selects:

* All (1) I want all records returned.
* Has (2) I only want records that have a mobile number returned
* None (3) I only want records that do not have a mobile number returned

The field mobile is text (to keep the leading 0)I thought of using the Switch function in the criteria of the query for field Mobile like this:

Code:
Switch([Forms]![frmPrintCustomer]![cboMobileStatus]=1,([tblCustomerContacts].[Mobile]) Like "*",[Forms]![frmPrintCustomer]![cboMobileStatus]=2,([tblCustomerContacts].[Mobile]) Is Not Null,[Forms]![frmPrintCustomer]![cboMobileStatus]=3,([tblCustomerContacts].[Mobile]) Is Null)

but the query does not like it!Am I on the right track, and if so, how should I modify the code?

View 2 Replies View Related

Selecting From Combo-box

Nov 8, 2006

I have a quick question on Forms. I have a combo-box in a Form that displays the student ID, first name, last name, and test scores from a source table. I have selected only specific fields to display from the source table in the combo-box. The intention is to note down the ID of a student for future querying purpose and I’m looking at easier ways to do it.

The question I have is, as I look down the drop-down and select a student by his last name (say Johnson), I want the student ID to be selected (or copied) when I click the specific student. There could be many students with same last name, and once I select a particular student from the drop-down, I was wondering if there was a way for this ID to be copied or selected. At present, the student ID is written down and used later for querying other information.

Thanks in advance.

View 1 Replies View Related

Queries :: How To Activate Query Criteria For Multi-combo Box Via Form

Aug 12, 2014

I am trying to make a form where the user can check/uncheck query criteria via several check boxes. The idea is that the user can start with many criteria and then deselect criteria if the search does not return enough results.

I have been setting up several queries and thought I would combine them in a "Master Query", since I thought it may be easier to deal with each criterion and the respective switch this way.

Lets say we run a hairdresser.

I have a field in the form that allows me to select clients. This is also used in the query. Works fine. Now to the hard part.

Example 1:

Each customer has a budget to spend on haircuts.
Each hairdresser offers haircuts from $x to $y.
The query should return all hairdressers that are appropriate for the budget of the selected customer.
There should be a yes/no button on the form to ignore or use this criterion.

Example 2 (this completely threw me off):

Each customer has a set of preferred services from a table (e.g. cutting,washing, coloring).
Each hairdresser offers certain services also based on this table (e.g. cutting,washing, coloring, drying).
The customer and hairdresser table use the services table and a multi combo box to select the services.
The query should return only hairdressers that offer some or none of the services wanted by the client.

Again, there should be a services yes/no button on the form to either ignore or include this criterion.

To clarify, the hard part for me is the query. I am fine with setting up the tables and the form. Just not sure how to implement something like "IF (ServicesCheckBox = -1, 'then use service criterion', 'ignore service criterion')".

View 7 Replies View Related

Queries :: Multiple Combo Boxes In Single Query Criteria

Nov 20, 2013

I managed to get separate combo boxes to filter out results on a query, however now I have a slightly different problem.

I managed to get the combo boxes to filter records in different query criteria, i.e criteria A for field A, criteria B for field B, etc.

Now I would like to have several combo box filters in one criteria field, however no matter how much I try to move the code about, they either filter out nothing at all, or show up blank records as they're filtering one after the other, i.e filter for A, and then B, which clearly won't work as there will be no B if you've already filtered for A.

The code I'm using in each criteria box is;

Like "*" & [Forms]![MyForm]![Combo1] & "*"

and this works as a single criteria in a single field.

View 5 Replies View Related

Queries :: Setting Criteria For Query Based On 3 Combo Boxes

Jul 10, 2013

Ok so im working in MS Access 2007.

I want to create a query based on 3 combo boxes but have it so that if the field in the second or third combo box is not populated the query still runs.

Right now i have the Criteria set for the three columns that i wish to sort by as seen below.

Column 1
Criteria: [Forms]![Entity Selection Form]![areabox2]

Column 2
Criteria: [Forms]![Entity Selection Form]![devbox2]

Column 3
Criteria: [Forms]![Entity Selection Form]![entitybox2]

This gives me the correct query result but im forced to make a selection from each combo box. Is there a way to progamme it so that if I only make a selection from the first combobox and leave the others blank i can still get results in a query?

View 2 Replies View Related

Selecting Item From Combo Box

Jun 5, 2005

Not sure what to search for so I thought Id write a new post:

I have a combo box which selects 3 items-

Primary key, Surname, Firstname

After an item is selected, the fields are populated according to the item.

Since there will be many records, it would be nice if the user can begin typing the surname and have predictive text, so the three items should then be-

Surname, Firstname, Primary key

So my question is, how do I get at the primary key if it is not selected?

myText = dlookup("myValue", "myTable", "primarykey = '" & ???? & "'")

If this does not make sense, what I am trying to say is:

The surname is selected, but I want to do a calculation based on the primary key so I get all the data associated with that user. I cant use the surname because there are duplicates.

Thank you

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved