using a combo box in a query

Teeboy

Board Regular
Joined
Jun 12, 2003
Messages
91
In the criteria field of a query's design view you can surround a phrase in square brackets and this forces a msg box prompting you for some data relative to the field it was placed....... The problem with this is you have to type in exactly what is in the table... Question is can i use a combo box in the criretria field? :eek:
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You can't use ActiveX controls from inside a query, you'd need to call this query from a form. The first thing that you would do is to create a Form and drop an Unbound Combo Box onto it. Follow the Wizard and specify its Row Source. Then, back in the query, in the Where Clause of the field which relates to the fields in the Combo Box, transcribe the following:
Code:
Forms!Your_Form_Name.Form!Your_Combo_Box_Name
Of course, replace my generic form and combo box names with your names. Last, you'd call this query in the AfterUpdate event of your combo box like:
Code:
Your_Combo_Box_AfterUpdate()
DoCmd.OpenQuery "Your_Query_Name",acviewnormal,acedit
End Sub
Make sense?
 
Upvote 0

Forum statistics

Threads
1,221,544
Messages
6,160,432
Members
451,646
Latest member
mmix803

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top