Problem With Criteria In Queries Using Combo Boxes

Jul 20, 2007

Let me see if I can explain this.

I have two tables: TblValues and TblLOC.

TblValues is a table of stactic values where I have listed about nine field names with values under each that usually will not change. This way if there is a change to one of the fields later, I can just add it to the table.

Then there is tblLOC. Here I have similar field names that matches each field in tblValues where I can populate them in my form. I have several fields defined as combo boxes. In the properties for each field defined as a combo box, for row source type has Table/Query selected and for the row source I have the following code in the table, which is an example for the field named Profit Code in TblLOC.

SELECT tblValues.ID, tblValues.Pro1Code
FROM tblValues
WHERE (((tblValues.Pro1Code) Is Not Null));

Then I have my form where I have referenced my fields from the tblLOC. In the properties of each combo box, under the tab labeled DATA, the control source has the name of the the combo box field that is in tblLOC, in this case Profit Code.

Everything works fine. The user selects a value from the form and tblLOC is updated. I can create queries without criteria with no problem. However, in a query if I try to add any criteria, even as simple as using "like" to identify a value in a field of the table that has been populated by the combo box, I will get no results. However, if I use the same functionality in a column where a combo box is not used to populate the field, I get the results that I expect.

Here is an example of the SQL in the query that does not work for me that is applied against a field that is a combo box.

SELECT tblLettersOfCredit.[Profit Code]
FROM tblLettersOfCredit
WHERE (((tblLettersOfCredit.[Profit Code]) Like "Misc"));


If I use the same functionality with a field that is not populated by one of the combo boxes then everything works fine.

I am hoping that there's a simple solution for this, maybe syntax due to the use of a combo box or maybe a property that I need to set... So far I have been unsuccessful in finding the answer. If anyone has any ideas on this one, I would certainly appreciate it. Thanks :)

View Replies


ADVERTISEMENT

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 :: Criteria From Multiple Combo Boxes On User Form?

Sep 29, 2014

I have a user form with six different dropdown boxes. I would like to create a query that gets its criteria from users selecting values from one or more of these boxes.

I have tried:

[forms]![frmName]![comboboxname] or [forms]![formName]![comboboxname] is null

in the corresponding query fields and get a "query is too complex" error message, even when only selecting one criteria.

What am I doing wrong?

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

Queries :: Query To Run Before Report Based On Criteria Based From Two Combo Boxes On Form

Mar 20, 2013

I have a report that gets its data from a query. I need the query to run before the report based on criteria based from two combo boxes on a form.

View 3 Replies View Related

Queries :: Multiple Combo Boxes And Text Boxes On A Search Form

Mar 24, 2014

I'm trying to build an database for aircraft operators. I've got the basic tables structure and relationships but I'm stuck on building an search form to filter records by user input.I've got following controls on my form (unbound):

1. AircraftType (combo box) from tblAircrafts
2. CompanyName (combo box) from tblListOfAircraftsOperators
3. TeailNumber (text box) from tblAircraftOperators
4. AirportNameSearch (combo box) from tblAirports
5. PassengersNumber (text box) from tblAircraftOperators
6. ManufactureYear (text box) from tblAircraftOperators
7. SourceSearch (combo box) from tblInfoSource
8. CountrySearch (combo box) from tblCountry
9. CategorySearch (combo box) from tblAircraftCategory
10. EamilToOperator (text box) from tblAircraftOperators
11. InteriorPhoto (Bound object frame) from tblAircraftOperators
12. ExteriorPhot (bound object frame) from AircraftOperators

I need to enable users to search for aircrafts based on those criteria. As I mentioned I'm new to Access and I don't have any advanced coding skills. I have a query build to perform the search and this is the code I've managed to write so far:

SELECT AircraftOperators.RegistrationNumber, AircraftOperators.PassengersNumber, AircraftOperators.ManufactureYear, AircraftOperators.EmailToOperator, AircraftOperators.ExteriorPhoto, AircraftOperators.InteriorPhoto, tblListOfAircraftOperators.OpratorName, tblAircrafts.AircraftType
FROM tblAircrafts INNER JOIN (tblAirports INNER JOIN (AircraftOperators INNER JOIN tblListOfAircraftOperators ON AircraftOperators.CompanyName =

[code]....

View 2 Replies View Related

Queries :: Query By Form With Check Boxes / Combo Boxes Not Working

Mar 25, 2013

Attached I have a database that I've been working on which has a form called "frmCriteriaSearch". It is based off of the qryCriteriaListBoxUpdate query. I am trying to get the listbox in the second tab of the results section to work. It queries fine for the checkboxes, but I cannot get the comboboxes to affect the query (unless a checkbox has already been selected)

View 6 Replies View Related

Using Multiple Criteria From Combo Boxes

Oct 6, 2005

Hi All,

I would like a form (in Access 2000) that allows users to search the database using combo boxes that specify criteria. So, upon load the form would be populated by every record, then as the user begins to make selections using the combo boxes they can narrow the results down to only a few (combo box filters are cascading; each one narrowing the results the other returned). There would also obviously need to be a reset button and 'all' fields in the combo boxes. I have found the code to filter by 1 combo box but if more than 1 is added (obviously) the filter resets to filter only by the current selection. (See the method I used here (http://www.freevbcode.com/ShowCode.asp?ID=4668))

Does anyone know how to bolt these together so they work in sync?

Please be gentle as I've only been learning Access for 2 months and VBA is still very new to me

Thanks,

Bobadopolis

View 3 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

Multiple Search Criteria With Combo Boxes

Dec 7, 2004

school has thrown me in to a bodemless ms access pit. can do a bit of VB but queries...I´m new to this stuff. i am glad to have found this fine forum.

i have:
-1 table: tblSpeler (65 entries)
-1 form: frmSpeler (already conected to a search query)
-1 search form: frmZoeken
*2 combo boxes: zoektekst (mp3 player make), zoektekst2 (mp3 player type), search button (cmdZoek).

my question:when i select a make, and then the type » i want that the form shows me the mp3 player with the selected make and type.

if more info needed, just ask. thanx

View 8 Replies View Related

2 Combo Boxes (2 Search Criteria) Won´t Work

Dec 12, 2004

i have a search form (see atachment1) with 2 combo boxes.
i have a pruduct form that runs on this query:

Code: SELECT * FROM tblSpeler WHERE (((tblSpeler.merk)=forms!frmZoeken!zoektekst1) And ((tblSpeler.type) Like forms!frmZoeken!zoektekst2));

if i start the the product form, it asks me for the make, and then for the player » it finds the right player in the form.
but via my search form it won´t work. it only opens the product form and no records are shown.

so: in the search form, when i select a "make", and then the "type", and then press search. i want it to show the right record in the product form.
+
when i select a make (eg "apple"), i want the type combo box to exclude all the types that are not from apple (eg only: ipod mini, ipod 20gb. right now it´s like in atachment2.

i know this is a common question, been trying to figure it out with a eg database, but i can´t get it done. all help is welcome

thanks,

-d

View 1 Replies View Related

DLookup Function Using Two Combo Boxes As Criteria

Oct 10, 2007

I have a form where I am using two combo boxes the second combo box fields are being based on what is selected from the first comb box. When I enter the DLookup criteria into the text box I am trying to lookup based on the selection of the combo boxes it returns nothing. Here is what my DLookup looks like:
DLookup("[BranchNumber]", "[tblAllADPCoCodes]", "[ADPCompany]= '" & [cboADPCompany] & "' And [LocationNumber]= '" & [cboLocationNo] & "'")

View 1 Replies View Related

Forms, Combo Boxes And Queries

Mar 2, 2005

howdy all, ive never touched Access until 2 days ago so my experience is
sorely lacking but here is my question:

i want to create a form with a combo box from which a selection is
made (data in the combo box is simply a field list from the same table the query is searching, but
my stumbling block is that i want to include the query in the
same form as the combo box and have it dynamically updates based on the
selection in the combo box.

however for the life of me i cant get the query to update based on the
input (using [Forms]![Form]![Combo1] as the criteria in the query) i have set this criteria in the
CustomerID field of the query (which is also the primary key of the table)

View 1 Replies View Related

Combo Boxes And Queries Again - Two On A Form

Mar 4, 2005

I have re-written this question as I think I managed to cause confusion!

(I really do need help!) My problem involves three tables. The first table is NAMES with an auto-number key field called NamesID.

The second table is a list of Dance Classes, called CLASSES again with an auto-number key field called ClassesID.

The third table is a list of MEMBERS in each dance class.

Obviously, the MEMBERS can belong to many CLASSES, and each of the CLASSES can consist of many MEMBERS.



My aim is to add a new record in MEMBERS by using a ComboBox containing records from the NAMES table.

On the form, I have a combo-box which shows me the list of CLASSES

(ComboClasses). I click on the class.

I then click on the NAMES combo-box, click on a name and want it to appear in the table of MEMBERS for the class shown in the CLASSES combo-box.

The problem

I am selecting the name using “ Select * From NAMES where Names.NamesID=[Forms]![FormName]![ComboNames] (supplied by supersubra) but how do I get the ClassesID into MEMBERS record.

At the moment, if I add a name that member appears in every class, or I have to manually insert the ClassID.



Philip

View 5 Replies View Related

Queries :: How To Filter One Field With 2 Combo Boxes

Jan 31, 2014

I have 2 unbound combo box's on a form 1 called cboclient1 and the another called cboclient2. would like to be able to filter field name client name twice by cboclient1 and cboclient2 here my sql from my query

Code:
WHERE (((Assets.Client)=Forms![report gen]!cboclient1)) Or (((Forms![report gen]!Cboclient1) Is Null));

This works perfectly for cboclient1 problem comes when I try and add cboclient2

I have tried

Code:
WHERE (((Assets.Client)=Forms![report gen]!cboclient1)) Or (((Forms![report gen]!Cboclient1) Is Null))AND(((Assets.Client)=Forms![report gen]!cboclient2)) Or (((Forms![report gen]!Cboclient2) Is Null));[/

This doesn't work at all....

View 2 Replies View Related

"Dynamic" Criteria For Combo-Boxes

Jun 14, 2006

Okay, this might be difficult to understand or tough for me to explain properly. Basically it's like this. I choose a cltContactID (a foreign key tied to a main Client's Contact's table). Then, in the next field, I'm choosing a source (for example: General Hospital) that referred the client to my company - call this refSource.

Then, in some cases, or most, I need to identify the person within that refSource that actually did the referring (eg, a Social Worker named Gene). Now I deal with 20+ Hospitals, 30+ Community Centres, 20+ Medical Centres, etc. etc., basically tonne of different sources.

So I would like the combo box, where I choose the person within a refSource that has referred a client, to only list people (or other staff personnel) that are affiliated with that source which I would have identifed one field earlier, rather than having a combo box that could potentially list hundreds and hundreds of names.

It's more complicated than just adding simple criteria in a query and making the combo-box look up that. The criteria must be dynamic; specific to each record.

Any insight?


Thanks,
Watson

I'm using Access2003 with WindowsXP. Thanks.

View 2 Replies View Related

Queries :: Multiple Combo Boxes To Filter A Listbox

Jul 13, 2015

I have a form where I am trying to use 4 combo boxes(nomenclature,BPN,vendor, and reference) to filter a list box containing part numbers. The way I have it set up right now is in the listbox it is searching for each field and then in the criteria section i have [Forms]![myform]![respectedFieldsCombo].

This works when selections are made from the combo boxes but when one is blank (not being used to filter) then I assume it passes null for that value and the listbox doesn't return anything. I have tried to make it so the listbox ignores null values but im still having this problem.

For example: If i only have a selection for the vendor combo box then i want the list box to show all respective part numbers for that vendor, where nomenclature or any of the other fields are irrelevant. I also want to be able to stack these filters upon every new combo box selection.

View 7 Replies View Related

Queries :: Auto-Populate Cascading Combo Boxes

Dec 18, 2013

I am working on a database where law clerks input the tasks that they accomplish each day. They use a form called "TaskDetails" to input all of the information related to their daily tasks via combo boxes. The problem I have is: often times the clerks work on the same task more than once and I would like them to be able to continue tasks already in progress - using notes to indicate what particular portion they completed that day.

In order to do this I would like to have a combo box that is based on a query of all of the tasks the clerks have completed. When they select a Task Name from the combo box, I would like all other combo boxes on the page to auto-populate based on the selection.The query that my combo box is based on includes all relevant fields.

When I click on the "Task Name" combo box I am presented with all of the records related to tasks. The fields/columns are divisionofwork, subcategory, workassignedby. I have combo boxes for all of these fields on the same page, bound to the table of tasks. Ideally, a clerk makes a selection from the "Task Name" combo box, and the subsequent 3 combo boxes will reference their relevant column in this selection and auto-populate.

View 1 Replies View Related

Queries :: Filtering Query With Text Box And Combo Boxes

Jul 23, 2015

I am creating a query that should filter records of events based on multiple fields. The filters should work with any combination of field criteria, but only two of the four field are working properly, as follows:

1. a text box for searching with event name (free text) - this is working;
2. a combo box to filter events by country name - this is working;
3. a combo box to filter events by event's keyword (category) - this is NOT working;
4. a combo box to filter events by year - this is NOT working

View 2 Replies View Related

Queries :: Search Query Using Multiple Combo And Text Boxes

Aug 13, 2013

I have a table with all information on it, that is input via various forms, I then have different queries pulling information from all information to run reports off. These all work fine, my problem is my 'Search Form' - below

I have created a query that finds information from 'all information' using

Like "*" & [Forms]![SearchAll F]![txtDateRasied] & "*"

This is working on all text boxes, It only half works on the combo box's when I use

Like "*" & [Forms]![SearchAll F]![combofailureanalysis] & "*"

If a selection is made in the combo box the query brings the correct results, however, if all the fields are left blank it should bring up every record, but it doesn't do this. I am certain it is the combo box's that are causing this anomoly as when I remove the combo box criteria it works perfectly again.

View 11 Replies View Related

Forms :: Run Specific Queries And Open A Report Using Combo Boxes

Jul 30, 2013

I have a form which runs specific queries and opens a report using combo boxes, these work perfectly fine if I just try to run them in the form. I have put the form into a navigation form and if I try to run the same query I get parameter queries popping up instead of just running the query and opening the report.

View 2 Replies View Related

Queries :: Form Setup - Allow Users To Select Parameters Using Combo Boxes

Apr 3, 2014

I'm wondering is it possible to create a multiple parameter query which will return results even if you leave some of the parameters blank ?. I'm trying to set up a Form which will allow users to select parameters using combo boxes but at the moment you need to fill them all in or you'll get no results...

View 10 Replies View Related

Queries :: How Can Query Display Info Based On Cascading Combo Boxes When Box (isnull)

Nov 27, 2013

I have a form with cascading combo boxes pulling from a table. They work perfectly, no worries. My problem now is if I do not enter information in every combo box (i.e. only two out of four combo boxes), how can I still run the query and get the appropriate information?

For example (these are my combo box titles in order):

Product
Type
Customer
Contract #

I don't want to necessarily look by Contract # all the time, but sometimes just by the general Product and Type to get a larger view. How do I set up expressions/criteria in my query to accurately produce that information? Right now it just produces a blank query table if I don't fill out all the boxes.

I've tried a couple of expressions with "isnull" criteria, but I must be doing it incorrectly.

View 2 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 :: Key Criteria Into Combo Did Not Show Up Any Result

Jan 22, 2014

I set my query criteria to my [Forms]![Form1]![Combo4].

After I key a criteria into combo4 , then I open again the query table ,

It did not show up any result , why ?

No combo4 don't have any event.

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







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