form as dialog box in a query is not working

wavemehello

Board Regular
Joined
Jan 24, 2006
Messages
221
This is the best forum I find to get help, so I hope I dont embarass you with my frequent visit.

I am trying to hook a form as a dialog box for a query. This is what I did.
-created a form without choosing table/ query
-created a combo box unbound
-right click, properties, row source, select the table, double click field to link. (Form alone runs fine.)
-create a new query of a table
-add required fields of table to show on the query.
-right click the criteria of the field where I want to hook the form as dialog
-build, double click forms, selected the combobox name,ok
-saved and ran the query, but no combo box dialog box appears. Instead a text box appears.

What wrong did I do here? cant figure out!! using Access2003
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi

You haven't done much wrong at all - you may just have a misunderstanding as to what you expect to see. Your query criteria should look something like this:

=Forms![MyFormName].[MyComboBox]

except you should see your form and combo box names.

So far everything you've done sounds ok. The query is looking to the form for the criteria so now you need to attach a button to the form, and get that button to open the query. Then after you select an item in the combo box, click the button and the query will show only those records that meet the criteria as per the combo box.

Don't worry about asking questions - that is what the forum is for! And if you get stuck just post a reply here.

HTH, Andrew
 
Upvote 0
That's the problem, the form which I am hooking to the query has a combo box which has department names and it also has OK and Cancel button. when a department is choosen and ok pressed, it filters those records only and also when cancel is pressed, the form is closed. I mean the form works fine when run alone. The combo box, ok/cancel buttons are all on that form which I want to hook on the query. This all works fine when the form is run alone but when it is called from the query, I dont get the form I get only a text box. That means the form is not hooked on the query while I think the steps are correct as you also mentioned!
 
Upvote 0
You don't seem to quite understand the concept.:)

By putting the control from the form as the criteria you are telling the query to look for it's value as a parameter.

Therefore the form must be open when the query runs to use the value on the form.

If it isn't then the query will prompt you for the parameter.

You don't 'hook' the form to the query.
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

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