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 Replies


ADVERTISEMENT

Queries :: Using Input From A Form As Criteria - Error When Running Report / Query

Aug 18, 2015

I have a query that uses the input from a form as criteria, which is then used in a report. The form input is a drop down based on another table. This is a sales pipeline report, and the list is a list of sales people. The report works perfect for all sales people except one. When I run it for the one, I get the following error:

"This expression is is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables".

I DO NOT get the same error when running the query by itself - so assuming there is something in the report causing this. I do have some sum formulas in the report.

Again, no other salespersons selected cause this error -- so I am assuming there is something in the dataset for this person that is causing the error.

View 8 Replies View Related

Queries :: Query Parameter Input On A Form (combo Box)

Jul 15, 2014

I have a table which holds information on audits that have been carried out on staff member's actions. The 'Supervisor' field is populated via a combo box which is linked to a separate table (tblSupervisors).

I am now trying to build a query to allow me to extract all audits that have been carried out on a specific supervisor - rather than the criteria to be [Enter Supervisor Name] and allowing text entry, I thought it would be better to have form that pops up with a combo box that is used to select the supervisor (from tblSupervisors);

So far:

- Form "Supervisor_Select" is created, and has a combo box that looks up from tblSupervisors

- Macros as specified in the instructions are created (Open Dialog, Close Dialog, OK and Cancel)

- Query is done, all bar the criteria expression on the desired field.

- Module is created as described in the instructions, and is called "Supervisor_Select"

I have tried putting the following in the criteria;

[Forms]![Supervisor_Select]![cboSupervisor], however I think I am missing the bit where the query opens the "Supervisor_Select" form?? Will this only work from a button where the on click event runs the 'Open Dialog' macro and then runs the query?

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

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

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

Queries :: Combo Box On Form That Passes Criteria To Simple Select Query

Sep 22, 2014

I have a combo box on my form that passes criteria to a simple select query. There are four possible selections to make from the combo box. For some reason, when I select the first option on the list the query runs perfectly. However, if I select the second, third or fourth option from the combo box, the query returns no records, even though I know there are records in my table which should be returned.

View 5 Replies View Related

Form Input To Query Criteria

Nov 4, 2005

Hi

This is simple im sure but i am a thicky

How do you allow a user to enter a value in a form; have access set that inputted value to a criteria in a query? Then ill have a button to run the query which i can do

thanks

thicky ste

View 1 Replies View Related

Input Criteria Into Union Query From A Form

May 31, 2006

Based on information from a earlier thread.... I created a Union query that pulls information from multiple tables and fields.


SELECT AG_B_R1 as Num FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_B_R2 FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_B_R3 FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_B_R4 FROM dbo_ADC_Ag_B_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R1 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R2 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R3 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_m_R4 FROM dbo_ADC_Ag_m_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_e_R1 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_e_R2 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll]
UNION ALL
SELECT AG_e_R3 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll]
UNION ALL SELECT AG_e_R4 FROM dbo_ADC_Ag_e_Res WHERE Rollnmbr=[roll];


And then I created another query to get the STDEV of the above query


SELECT StDev([Num]) AS StDev
FROM Q_cals_ag_bme_STDEV_Union;

The result will be on a subform on my main page. How do I get my form to input the [roll] automatically and requery the subform, showing my result.
Thanks

View 1 Replies View Related

Query Criteria Based On An Input Date

Oct 2, 2006

I have a database with the following information:

FTA # Date Attended Last name First name assigned person......

Each week I need to generate a report that shows the people that attended for that week, grouped by the assigned person. I only want to show the data for a specific "date attended" (i.e. that days date). I figured I first need to generate a query that only returns the data for that specific date in the "date attended" column. I did that but it is manuel by using the criteria field.

Is there an easy way to type in the date that I want the query to use as the criteria?

Thanks
:o

View 14 Replies View Related

Form To Input Query Criteria Between Dates

Jan 30, 2006

I have this select query.
SELECT DISTINCTROW L160.Date, Avg(L160.Zinc) AS [Avg Of Zinc], Min(L160.Zinc) AS [Min Of Zinc], Max(L160.Zinc) AS [Max Of Zinc], Count(L160.Zinc) AS [Count of Zinc]
FROM L160
GROUP BY L160.Date
HAVING (((L160.Date)=[Forms]![L-160quarterfrm].[Date]));
How do I build a form that would ask the user to input a range of dates for the criteria?
Thanks! :o)

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

Modules & VBA :: User Input Criteria For Union Query?

Aug 20, 2013

I am trying to get my VBA code to dump a query once the user pushes a button. I have the following code to call up the Excel app.

Code:

Option Compare Database
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long

[code]....

The qry_PP_Errors_Union is a Union query. In this query there is a date field. I would like to be able to to use that date field as a parameter. So I have written this VBA to prompt the user for a Begin Date and an End Date.

Code:
Beep
strBegindatemsg = "Enter the beginning date." & vbCrLf & vbLf
strBegindate = InputBox(Prompt:=strBegindatemsg, Title:="Begin Date")
Beep
strEnddatemsg = "Enter the beginning date." & vbCrLf & vbLf
strEnddate = InputBox(Prompt:=strEnddatemsg, Title:="End Date")

Now the part that I am missing is that I am not sure how to make the "strBegindate" and "strEnddate" the criteria for the union query.

The following is the SQL for my union query.

Code:
SELECT LastName, FirstName, Title, TeamName, WorkOrderNumber, DateCompleted, WorkCode, UICError AS Error, "Update and Internal Correspondence" AS Category FROM qry_PP_UIC_Error
UNION
SELECT LastName, FirstName, Title, TeamName, WorkOrderNumber, DateCompleted, WorkCode, BIDError, "Bids" FROM qry_PP_Bid_Error

[Code] ....

Without the criteria, my code works for dumping everything out into Excel. However, dumping all the data results in a 7 mb Excel file that requires manual deletion of the information that is not pertinent.

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

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 6 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 :: 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 :: Insert Text From Textbox On A Form When Combo Box Meets Criteria?

Jul 12, 2013

Is it possible to insert text from a textbox on a form (Data) when a combobox on (Data) meets a criteria?

Example: Test: IIf([Results]="Positive" text207)

So if the Results combobox is Positive then the text from Text207 is inserted.

View 9 Replies View Related

Queries :: Query Using Input And Listbox?

Nov 11, 2014

The query below is supposed to accept some characters from the user and bring up a list of records satisfying the criteria. TelephoneAAA is a table with many columns. The query does not give any error message receives input from user runs quietly and does not give any result. I know that the table contains sufficient data. Probably I am missing something obvious but what.

Code:
RowSourceQy = " SELECT * from [TelephoneAAA] " & _
"WHERE (([TelephoneAAA].[SOYADI]) Like ((' * ')+ [Word] +(' * '))) OR " & _
"(([TelephoneAAA].[ADI]) Like ((' * ')+[Word]+(' * '))) OR " & _
"(([TelephoneAAA].[ADRES]) Like ((' * ')+[Word]+(' * ')))" & _
"ORDER BY [TelephoneAAA].[SOYADI], [TelephoneAAA].[ADI], [TelephoneAAA].[TEL];"

View 3 Replies View Related

Queries :: Using Combobox To Input A Value Into A Query

Feb 27, 2014

I am trying to use a combobox to select a value which then activates a query to return results.

Here is some details

I have to tables, one called "Customers" and the other called "Calls". These two tables are linked.

The customers is literally a list of customers with their contact details, but all I am in interested in is the "Company" Field.

The Calls table has a field called "End User" which looks up the company from the Customers Table.

What I am trying to do is create a search by Customer query, furthermore, I would like to do is to create a form with a drop down that looks up from Customers table, select the company and it returns all the records with that company...

What I have done

I have created a query that has the customer and calls tables included, I have dragged down the [Company] from customer table and then all the fields from the Calls table.

Then i created a blank form, inserted a combobox - Combo7, linked the box to the Customers table.

Back to the query, under the [Company] I have put into the criteria the following

Forms!sc!Combo7

Back to the form, selected the combo box, built a macro in the AfterUpdate, to run the query.

Tested this and it does not bring anything back, however if I put into the criteria Like [Please Enter Company Name], then typed the company name, it brings back all the records for that customer.

Am I missing something?, do I need to set the form control to the query, or even the combobox....

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

Queries :: Form Input Not Being Recognized By Query

Jul 10, 2013

I maintain a grade book application that uses many queries whose results are determined by "school year". Most of these are reports and I have a combo box on the Print form for that allows the user to select the school year. The criteria field of the several queries derived by school year is:

[Forms]![Main Navigation]![Print Form]![SchoolYear]
SchoolYear being the combo box control.

They work fine.

I have now added a function to export data to Excel. This is done in a VBA module and I am using a query to select data for the record set I use to write to Excel:

Set objRst = Application.CurrentDb.OpenRecordset(strQueryName)

When I hard code the school year in the query criteria field (i.e. "2012-2013") the process works fine, but if I revert the query to point to the print form field as above, I get an empty recordset.

The Excel export is executed from a control on the Print Form, so the form is open and the combo has data showing, just as it is when a report is run whose data is derived from a query.

When I execute the query from the VBA module, the query is not getting the school year selected on the Print form passed to it properly.

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







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