Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 23rd, 2004, 06:32 PM
Authorized User
Join Date: Jul 2003
Location: Melbourne, Vic, Australia.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Combo Box Parameter Query

I have just discovered how you can run a parameter query using a list from a combo box. I have included a link to save you reading my convoluted way of discribing the technique. http://www.fontstuff.com/access/acctut08.htm).

What I don't understand is how you can get the query results linked to a form, as you cannot run the parameter query from within itself and so cannot link it directly to a form.

Any help would be greatly appreciated.


Old June 23rd, 2004, 09:31 PM
Friend of Wrox
Join Date: Jun 2003
Location: , , USA.
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts


You need to create a second form to display the results of your selection criteria instead of displaying them in query view.

Create a new from by selecting 'Create form by using wizard' in the database window.

On the Wizards first page:

1. Select 'Query: qryStaffLocator' form the Tables/Queries dropdown list.

2. Move all Available Fields to the Selected Fields list (FirstName, LastName, Office, Department).

On the Wizards 2nd and 3rd pages select columnar layout and standard style (or whatever you like).

On the Wizards last page:

1. Name the form 'frmStaff'.

2. Select the 'Modify in Design View' option button.

When the form opens in design view, simply close it.

Go to the code window behind your selection dialog form (frmStaffLocator)

Change this line:

DoCmd.OpenQuery "qryStaffLocator", acViewNormal, acEdit

to this line:

DoCmd.OpenForm "frmStaff", acNormal

Now open your frmStaffLocator dialog, select criteria, and press OK. Your form will open and display records that meet your criteria, instead of your query.

What you have done is set your frmStaff's Record Source property to 'qryStaffLocator' which you can see by clicking on the Data tab of the form's properties window when you are in design view.

Post again if you have further questions.


Old June 24th, 2004, 06:32 PM
Authorized User
Join Date: Jul 2003
Location: Melbourne, Vic, Australia.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts


Replied to you in the Access forum but felt the need to thank you in this one as well. It works great and I appreciate your kind help.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Not able to pass the combo box value to SQL query sparsh2010 Access VBA 3 July 26th, 2006 07:10 AM
Query based on combo box selection help Elain Access 1 January 3rd, 2006 11:33 PM
Combo Box Parameter Query stevewardau Access 3 June 24th, 2004 08:44 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.