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 / Forms Programming / February 2007

Tip: Looking for answers? Try searching our database.

parameterize select statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
clara - 22 Feb 2007 20:20 GMT
Hi
there are two combs in a form. They are all based on select statements to
fill data.
one selection of a comb should decide the other's select statement's where
clause.
How can I do it

Clara
Signature

thank you so much for your help

Marshall Barton - 22 Feb 2007 22:11 GMT
>there are two combs in a form. They are all based on select statements to
>fill data.
>one selection of a comb should decide the other's select statement's where
>clause.

Use the first combo box as criteria in the second combo
box's row source query.  e.g.

SELECT f1,f2
FROM table2
WHERE f3=Forms!theform.combo2

Then in combo1's AfterUpdate event procedure:
    Me.combo2 = Null
    Me.combo2.Requery

You will probably also want the Requery line in the form's
Current event.

Signature

Marsh
MVP [MS Access]

clara - 27 Feb 2007 21:31 GMT
What there is an "All" option item in the first comb list.That will mean the
where clause will be erased away

clara
Signature

thank you so much for your help

> >there are two combs in a form. They are all based on select statements to
> >fill data.
[quoted text clipped - 14 lines]
> You will probably also want the Requery line in the form's
> Current event.
Marshall Barton - 28 Feb 2007 18:34 GMT
>What there is an "All" option item in the first comb list.That will mean the
>where clause will be erased away

You could reconstruct the second combo box's RowSource SQL
statement, but it might be easier to change the query's
criteria for field f3 to:

Forms!theform.combo2 OR Forms!theform.combo2 = "ALL"

Signature

Marsh
MVP [MS Access]

 
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.