Topics Search

Run query based on value in combobox

Run query based on value in combobox
Views: 65
I have a form with a combobox containing a list of elements. The row source type for the combobox is a query (SELECT Elements.Element FROM Elements ORDER BY Elements.Element). I would like to run a different query depending on the element selected in the combobox.

Each query will be a parameter query, the parameter values being provided by text boxes on the form.

I was thinking that I could add a column to the Elements table to hold the name of the query associated with each element.

I am not sure how to retrieve both columns from the Elements table into the combobox so that the query could be executed by clicking on a button on the form
Sponsored Links:

More topics

 

Run query based on value in combobox

Preview
I have a form with a combobox containing a list of elements. The row source type for the combobox is a query (SELECT Elements.Element FROM Elements ORDER BY Elements.Element). I would like to run a different query depending on the element selected in the combobox.

Each query will be a parameter query, the parameter values being provided by text boxes on the form.

I was thinking that I could add a column to the Elements table to hold the name of the query associated with each element.

I am not sure how to retrieve both columns from the Elements table into the combobox so that the query could be executed by clicking on a button on the form.
 

ComboBox not listing multiple columns

Preview
I have a combo box based off a query. I want to add a second column to the combobox, so I went and added the field that I want added to the query that the combobox is based on. But when I went to go create a new ComboBox, it is not showing all the fields from the query it is based on! Why is this?
 

referencing combobox in query

Preview
I have been having trouble updating and referencing a combobox located in a subform. The combobox in question's row source is tied to a query that narrows the users choices based upon a previous entry in another combobox. The query does not work correctly; when you select the combobox, the control reference pop-ups as a null value each time.

Currently, I referring to the combobox control as [Forms]![Proposal]![Tests subform]![cbotestm], which works when you run the query separate from the form, but doesn't when the query is run through the combobox row source. I have seemingly tried every other syntax I can locate for the control name, e.g. [forms]![Proposal].[form]![Tests subform]![cbotestm], none of which seem to work.
 

Query based on ComboBox selection

Preview
I'm trying to create a query that will run based on what is selected in the combobox. I have a main form which holds the subform with the combobox. I want a button to open the query. The query field references the combobox with [forms]![subFrmName]![cboName].

My problem with this comes when I press the button and I get a message box titled "Enter Parameter Value" with my field reference line Forms!subFrmName!cboName with a text box underneath.

Am I doing something wrong? I've checked the subform name and combobox name multiple times and it appears that I'm referencing them correctly.
 

Query based on ComboBox selection

Preview
I'm trying to create a query that will run based on what is selected in the combobox. I have a main form which holds the subform with the combobox. I want a button to open the query. Thequery field references the combobox with [forms]![subFrmName]![cboName].

My problem with this comes when I press the button and I get a message box titled "Enter Parameter Value" with my field reference line Forms!subFrmName!cboName with a text box underneath.

I've checked the subform name and combobox name multiple times and it appears that I'm referencing them correctly.
 

Run macro from combobox NOT based on selection

Preview
Is it possible to call/run a macro from a combobox but it is NOT based on the combobox selection?

I know you can do it based on the combobox selection but that is not what I want. I have the user make a selection from the combobox and store it as a variable under the afterupdate event criteria. Within that same afterupdate event, I want to close the form and run a macro that will allow the user to select a file using the API command dialog box.

I have the command dialog box macro runnig fine and can call it from a button with no problem. Just need to be able to call it from within a combo box.
 

Query based on combobox

Preview
I have a one table that has my different fields in it. What I want to do is make a query that will search those fields depending on what is selected in the combobox.

For instance, if I want to search my data for serial numbers my query will chose the serial field if that's what the combo box is set for and then ask for an input to search against that field.

Right now I have the combobox displaying my fields, but I cannot get a query to work based on the content of the combobox
 

Combobox Selection To Run Query

Preview
I have a form that will show static data in textboxes that are in the form detail and form header based on the selection of a job number in a combobox that is in the form footer.

The data has to come from 2 different tables. I assume I have to create a query based on the data I want from each table. How do I link the combobox selection to the query criteria: so thatit only returns the data for that job number and once that is done how do I get it to display in the form textboxes.I know how to get the combobox to populate the textboxes with data fromone table.
 

Query based on subform combobox

Preview
I am trying to build a query based on a combobox that is on a subform that cascades from a combobox on a main form. So far I have :
INSERT INTO tblSubTeamEvent ( SubTeamID, EventID )
VALUES (Me!SubFormSubTeamForm.Form!cmboSubTeamSF, [Forms]![frmEvent]![EventID]);
but when I run it it asks for the parameter value of the cmboSubTeamSF. If I just ignore the question it still updates the EventID into the table but obviously not the SubTeamID. I've tried various combinations of Me! Forms! etc but can't get it to work any ideas any one
 

Query based on Value in a Combobox

Preview
I have a form InvInputfrm that has a combo62. When I select the value in that combobox I want it to be the parameter for my select query. This result will then populate combo64 of the InvInputfrm. Then based on the selection of combo64 a textbox will be filled in with data from column (1) of that combobox.