Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / June 2005

Tip: Looking for answers? Try searching our database.

Combo box for queries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
expitionaught - 22 Jun 2005 18:27 GMT
when opening a query that has a set criteria a window opens with text box. Is
it possible to change the text box into a combo box so that the proper query
criteria can be selected rather than typed?
Rick B - 22 Jun 2005 18:36 GMT
This has been answered at least once TODAY.   Please search the newsgroups
for your answer before posting a new thread.

You can add a acombobox to a FORM and then use the entry in your query, but
you can't do this directly in your query.

For more details, do a search and read the other posts related to this
topic.  Many of them have step-by-step instructions for creating a parameter
form.

Signature

Rick B

> when opening a query that has a set criteria a window opens with text box. Is
> it possible to change the text box into a combo box so that the proper query
> criteria can be selected rather than typed?
fredg - 22 Jun 2005 18:47 GMT
> when opening a query that has a set criteria a window opens with text box. Is
> it possible to change the text box into a combo box so that the proper query
> criteria can be selected rather than typed?

Adapt this to your needs.

Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set it's Column Count property to 2.
Set the Column Width property to 0";1"

Add a Command Button to the form.
Code the button's click event:

DoCmd.OpenQuery "QueryName"
DoCmd.Close acForm, Me.Name

Name this form 'ParamForm'.

As criteria in the query CompanyID field write:
forms!ParamForm!FindCompany

Select the company, click the command button, the query will run.

Signature

Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Guy Story - 30 Jun 2005 22:01 GMT
I am trying to expand on your example and have hit a stumbling block.  I
was able to duplicate the example fgut gave and have it execute a query.
 I want it to execute a report instead. The report executes the query
so the criteria for the query should be the same. The only change I was
expecting to do was instead of DoCmd.OpenQuery was use DoCmd.OpenReport.
 That works but the issue I ran into is the actual query.  The data
field that I have allows for entry of multiple cancer types.  They may
not be in the same sequence or count so I use" like "*" & [Enter cancer
type] & "*".  While this works like I charm, I would prefer the combo
box to give the types.  Removes the misspelling issue.  I tried: like
Like "*" & [forms!FindCancer!FindCancer] & "*".  I select the type, the
report executes but the result is a blank report.  If I remove [] and
use "" I get everything in the table instead of the desired type.  If I
remove Like "*" & components, it generates a blank report. What am I
missing.

Thanks,

Guy

>>when opening a query that has a set criteria a window opens with text box. Is
>>it possible to change the text box into a combo box so that the proper query
[quoted text clipped - 23 lines]
>
> Select the company, click the command button, the query will run.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.