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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,432
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
 

wavemehello

Board Regular
Joined
Jan 24, 2006
Messages
221
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!
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,304
Office Version
  1. 365
Platform
  1. Windows
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.
 

Forum statistics

Threads
1,141,761
Messages
5,708,367
Members
421,566
Latest member
7Nabisco

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
Top