Queries :: Run Query Based On Combo Box Selection On Button Click

Jun 25, 2013

I am currently working on an existing database (not created by me) which contains several queries. Each query relates to a particular product.

I am wanting to create a form which has a combo box so that a user can choose a particular product from the combox options and then click on the command button to run the correct query.

How to do this. I have created the form and the combox (together with the list of products). I just need to know what Event Procedure code I need to enter to programme it to look for the correct query and then run it.

For example.

I have the following queries
product1query
product2query
product3query

I have the following options in the combo box
product1
product2
product3

How do I get the command button to look at the product1 option in the combo box and then find and run the product1query.

View Replies


ADVERTISEMENT

Change Value In Query From Command Button Based On Selection In Combo Box?

Jun 3, 2015

I have a dashboard-style form that has a list box with tasks connected to a query with line items of those tasks.

I have another query that will only show the line item selected from the list box. This means the query will only have one line item.

I want to have a command button below the list box that, when clicked, will modify the solo item in the second query to change a yes/no field from no to yes.

How can I accomplish this? Also, how can I make a button that deletes the selected line item?

View 3 Replies View Related

Forms :: Mouse Click Can't Work On OK Button For Combo Box Selection

Aug 25, 2014

I get a bizarre situation while I am using MS Access 2010 to select values with Combo Boxes on a form, i.e.:

* After I select one or more values from the drop-down list of a Combo Box, there is no response when clicking OK button using the mouse. It is stalled. I need to do the process again and then the mouse-click on OK button could work: click anywhere outside of the combo box, re-select the values, click OK Button, and done.

* However, I can always use Enter key (on the keyboard) upon OK button to complete the selection.

* The values in the drop-down list of the Combo Box were entered manually.

What is wrong with the combo boxes on the form? Why do I need to do twice to complete the selection using mouse-click? Why the keyboard-click ('Enter') can be always OK but not for the mouse-click?

View 8 Replies View Related

More Info Button Based On Combo Box Selection

May 21, 2012

More Info" button based on Combo Box selection. I need to create a command button that can be used to see all of the data in the table for whatever name is selected in a combo box. For example, if John Smith is selected from the combo box, the user could click a "More Info" button, which will open a separate form showing all the data in the table for John Smith.

View 1 Replies View Related

Queries :: Populating One Combo Box Based On Selection In Another

Jul 20, 2014

I can't quite get my code right for populating one combo box based on the selection in another. I didn't create this Access database but I've been asked to add in a second combo box that is based on the selection of the first combo box.

My first combo box is for Rohe (the location of the Maori tribe) and the second is Iwi (the tribe name). So my first combo box (Rohe) has Dvic_ROHE written in the control source and its row source code is:

SELECT tblLookUpValues.DatabaseFieldValue
FROM tblLookUpValues INNER JOIN tblFormQuestionLookUp ON tblLookUpValues.LookUpID = tblFormQuestionLookUp.LookUpID
WHERE (((tblFormQuestionLookUp.FormID)=2) AND ((tblFormQuestionLookUp.QuestionNumber)=75))
ORDER BY tblLookUpValues.DisplayOrder;

The combo box for Rohe (tribe location) is populated by a table named tblLookUpValues. The second combo box for Iwi (tribe) has Dvic_Iwi in the control source. I created a table named tbl_Rohe_Iwi_lookup that contains ROHE (a list of tribe locations) and IWI (the tribes). There are 12 tribal locations and another 10-14 tribes in each location.
The form that the Rohe and Iwi combo boxes are located on is called frmDeceased. This is the code that I attempted to write so that the second combo box (Iwi) is populated with only the tribes that are in the Rohe (location) that was selected from the Rohe combo box. But when I run the query it comes back with no results.

SELECT distinct tbl_Rohe_Iwi_lookup.Rohe, tbl_Rohe_Iwi_lookup.Iwi
FROM tbl_Rohe_Iwi_lookup
WHERE (((tbl_Rohe_Iwi_lookup.Rohe)=[forms]![frmDeceased]![Dvic_Rohe])) UNION select distinct null, null
FROM tbl_Rohe_Iwi_lookup
ORDER BY tbl_Rohe_Iwi_lookup.Iwi;

View 5 Replies View Related

Queries :: Sum Table Values Based On Combo Box Selection?

May 20, 2014

I am trying to write a query that gets all the telephone hours from a worker done under supervision in a town (qry_svhoursbytown). I have a table that has the workers details, including town (Crisis_support_workers), then another table that has what hours each worker has done (Supervision_Hours). The town is selected from a combo box on the form (frmSearch), under the heading �total hours by location�.

I try and select Bathurst then press recalculate results and in the text box next to supervision hours, it says 66, but if you look in the Supervision_Hours table, there is only 11 hours for the workers that are in Bathurst.

In the query, I have the sum total of the hours field in the Supervision_Hours table, the Town field from the Crisis_support_workers table with the total selected as Where and in that criteria I have [forms]![frmSearch]![ComboTown], then I just have the town field displayed.

What do I need to change to get it to sum correctly?

I have attached the database below so people can take a look.

View 1 Replies View Related

Queries :: How To Update Combo Box Values Based On User Selection

Sep 25, 2014

I have a combo box which gets its values from sql server using a query which is called "get_query_reason", which works fine. Now I want to update combo box values based on a user selection, st string. Have written the code, but does not work:

Dim qDef As QueryDef
Dim Query As String
Dim st As String
Dim rs As Recordset
st = "SOV"
Set qDef = CurrentDb.QueryDefs("get_query_reason")

[Code]....

View 3 Replies View Related

Refreshing A Query Based On A Combo Box Selection

Dec 1, 2004

I have a form on which i make a selection. This selection then populates a query which in turn generates a report. The problem that i have is that when i go back into my form and make another selection the query, and therefore the report, holds the original data.

My question is how can i refresh the selection and therefore produce different reports based on this selection without exiting the application?

Many thanks for any help provided in advance.

View 4 Replies View Related

Queries :: Can Run A Query Based On A List Box Selection

Jul 31, 2013

I have a query that allows the user to put in a date range - this works.He also wants to limit what he prints.

For example at the moment he gets

OrderA rest of line 1 for orderA
OrderA rest of line 2 for orderA
OrderA rest of line 3 for orderA
OrderB rest of line 1 for orderB
OrderC rest of line 1 for orderC
OrderC rest of line 2 for orderC
OrderD rest of line 1 for orderD
.
.
.OrderZ etc

He only wants to say print lines for OrderA and OrderD. It's he's choice and not based on anything else already in the table.

I see that in the criteria on the design for the query it allows me to bbuild an expression and I can select a list box on the form such as

[Forms]![name of form where list box is]![name of list box].[EXPRESSION VALUES]

I don't know which expression value to choose. I have tried afterupdate and beforeupdate but none of the rest look like they are the ones I should be using.

View 1 Replies View Related

Queries :: Dynamically Add Fields To SQL Or Query Based On Form Selection

Nov 6, 2013

Is it possible to add a field (i.e., variable) to a query (or SQL programming) based on a form selection?For instance, if I use a form to allow an end-user to specify which fields they wish to include in the query (essentially creating a UI for the query builder), how would I go about creating the query/SQL or updating the query/SQL?

View 3 Replies View Related

Queries :: Creating Unmatched Query Based On Selection From Two Combobox

Apr 15, 2013

I created 2 combobox that list specific table in a data base. I want to create an unmatched query based on the selection from those two combobox.

All field in those table are the same.

View 3 Replies View Related

Queries :: Parameter Query Failed Based On Selection From Drop Down List

Feb 23, 2014

When creating a query I have set up a parameter query as instructed (in this case searching for a name) but when I run the query it returns the error 'this expression is typed incorrectly etc.'

I have worked out that this must be due to the fact that the names are not typed in by a front-end user but need to be chosen from a dropdown list (which i have stored in a separate table) - So, the query seems to fail based on that.

View 10 Replies View Related

Change Combo Contents Based On Previous Combo Selection

Oct 20, 2005

Hi everyone,

I have two combo boxes on the same form bound to a table. I want the contents of the next combo box to change based on the previous combo selection e.g

cboContinent cboCountry
Africa Zambia
Africa Congo
Africa South africa
Europe England
Europe Holland

If I choose Africa in cboContinent, I want to see only Zambia, South Africa and Congo under cboCountry and if I choose Europe I want to see only England and Holland

Thanks
Humphrey

View 1 Replies View Related

Populate Combo Box Based On Selection In Another Combo Box (Access 2010)

Jul 11, 2012

I'm have quite a difficult time getting a form in Access 2010 to perform the way I would like it to. I have multiple tables that I've created, and a query that contains the data from the various tables. I then ran the form wizard to select the data from the query that I wanted to populate in my form and I've added 2 combo boxes.

What I want to do:
1. I want users to be able to select a category in combo box #1 (example: "Bag")
2. I want users to be able to select a detail in combo box #2 based on the category they selected in combo box #1 (example: Combo box #1, "bag" would populate the following selections for combo box #2: "sandwich" and "tool")
3. I want users to then receive a list of suppliers that provide the product they have selected, either "Bag: Sandwich" or "Bag: Tool"

I have combo box #1 populating a list of categories already. However, I am not able to get combo box #2 to provide choices based on the selection chosen for combo box #1.

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

Forms :: Combo Box Value Based On Selection In Other Combo Box?

Nov 29, 2014

I'm trying to build a database for daily work. My work in daily basis I have to fill all condition for several items.

We have two areas, with two locations under each area, and three systems under each location and each system contain more than 500 items.

I created all tables and fill by all information:

1-Table 1: Area 1, Area 2, Area 3, Area 4, Area 5, Area 6.
2-Table 2: Location 1, Location 2.
3-Table 3: System 1, System 2, System 3.
4-Table 4: all items under System 1-1-1
5-Table 4: all items under System 1-1-2

[Code] ....

Last table will be LogBook which will be as follow:

date l time l area l location l system l item l Conition1 l Conition2 l Conition3

My question regarding to the form of the above table:

How can I make a combo box for area field and when I select for example area1 will appear only the locations which under area1 in location field, and when I select location1 for example will appear only the systems under location1 in system field, and when I select system1 one for example will appear only items under system 1.Combo box list will be based on the selection in previous combo box and so on.

View 3 Replies View Related

Combo Box Values Based On Another Combo Box Selection

Feb 6, 2013

I have a form, with a subform and another subform

Once a supplier name is selected from the combo box i only want it displayed that suppliers products in the subform, subform. (products combo box) I can get a basic query to show these results but can get the combo box to do the same.

The design screen is also attached below ....

View 14 Replies View Related

Modules & VBA :: Create Multiple Records Based On Date Range - Button Click Event

Jul 31, 2014

I work for a company that manufactures home appliances & electronics. When those products fail within the warranty period, we are obligated to repair the units for the customers.

We have around 200 factory technicians who make those repairs. Each tech is able to make approximately 8 repairs each day. We have a dispatching system that assigns the repairs to the techs based on their availability each day. But the problem is that we have to manually enter and adjust the schedule for all 200 techs every single day, and this takes a lot of time. And of course technicians get sick, take vacation, etc, so we have to adjust the schedule so no techs will be assigned calls when they're off.

The problem: For example, currently when a technician takes off for 2 weeks, the user has to enter 14 individual records for the tech, which is somewhat time consuming. What I need is to program a button click event to determine the two dates (startDate & endDate) and append multiple records from one single entry in the form for each date in between and including the two date fields.

I know I'll probably need to create a loop that will loop through the two dates on the form and append a record for each day, so I can then cross reference the dates to the master schedule dates to make sure that no availability is opened for the techs taking time off.

View 3 Replies View Related

Modules & VBA :: New Record Button With Prefilled Number Based On Selection On Another Table

Jan 6, 2015

I'm making a database that so I can log calibration information about equipment every year.I have 2 tables:

The Equipment details table
The Calibration record table

ID Number is shared between the 2 tables so a calibration record can be linked to its' details.

For Example (simplified sample data):

Equipment Table
ID Item Unit Type
104 Thermometer DegC PT100

Calibration Table
ID Cal Point 1 Test Equipment Unit Under Test Date
104 20 21 22 06/01/15

What I want is a button on a form that creates a new blank record in my Calibration record table with the ID number already entered based on what record I selected in a combo box linked to my equipment table. I really don't know where to start.

View 2 Replies View Related

Querying Based On Combo Selection

Jan 27, 2006

Right, I think this is a quick and easy one....just not for me!

I have a combo box with a list of names. I want to use whichever name a user selects as criteria for a query.

What do I need to type in the query criteria box or as SQL?

View 2 Replies View Related

Textbox Based On Combo Selection

Jan 19, 2006

I choose a ‘Year’ from a combo box. Why doesn’t the data in my textbox update? (It’s a count of records for that year)

View 2 Replies View Related

General :: Based On Combo Box One Selection

Jul 29, 2012

if it is possible whereby if a user makes a selection in combobox 1 it must automatically generate the given vaules in combobox2 from the selection in combobox 1.

View 1 Replies View Related

Combo Box Event Based On Selection

Oct 18, 2011

I know how to assign an event to a combo box, but I want to be able to launch a specific link, app, or email template, based on the actual selection from the combo box. So when I make a selection, whatever program or event I assign, to that specific selection, will launch.

View 14 Replies View Related

Refresh Subform Based On Combo Box Selection

Dec 30, 2005

I have a form with three subforms, and I'm having problem with one of them. The link between subforms and forms are store number, which is stored in a combo box. Idealy, after a user pick a store from the combo box, the subform would update itself. Two out of the three subforms are based on two crosstab queries and they work perfectly fine. The last subform is a select query, and it seems like it's not rerunning itself after updating the combo box. The query is very simple, it just has store number, description, and grouped by amount. I tried with no criteria in the store field and run the masterform,seems like all it's doing is showing value for the first store in the table, and never changes afterwards, I also tried entering "forms!frmStores!cmbStore" in the criteria for the store, then the subform came out empty, it seems like it's only reading combo box's default value null. I have a line of code for the mater form frmStores as "me.[DisplaySubform].requery" for all three subforms, but it seems like it's working for the first two and not the select query. Anybody can help me with this? oh, the combo box is unbounded, because i do not want my table to be updated by selection. Please help

View 1 Replies View Related

Print Form Based On Combo Selection?

Apr 10, 2006

Hello!

I have almost completed my database, everything I had originally intended to implement into it has been done, with some extra added features I popped in along the way. There is just one more thing I require assistance with...

My database is used for booking camera kits in and out. On the add booking form the user has to pick a "Camera Type" from a combo box. When they have made their selection, a form pops up with details of all of the components contained within the kits. The user can then check/uncheck the relevant components and close the form.

I have used a command button which prints off the data contained within the current booking form, and also the data contained in the form that pops up when the camera type is selected.

However, as there are more than 1 different types of camera, comprising different components, I need to be able to print off the form relevant to the kit type.

I do not know how I can do this as I have just specified the command button to print the form for the default kit.

I basically need some VB code which will print the form based on my combo selection, as my knowledge of VB is pretty primitive, I was wondering if someone could help me out :)

Any help would be appreciated!

View 2 Replies View Related

Enabling Textboxes Based On Combo Box Selection

Nov 8, 2006

Hi all,

Is there any way of enabling/disabling a number of text boxes/checkboxes, based on a combo box selection, for example:

Combo Box 1: Airport Selection
Combo Box 2: Customer Selection

Once the user has selected the customer, based on the airport selection there will be about 10 text boxes and a few checkboxes that I'd like to allow or "ghost" depending on whether we are contracted to carry out work for that customer.

Any help would be appreciated.

thanks, Graeme

View 2 Replies View Related







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