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 / May 2008

Tip: Looking for answers? Try searching our database.

Combo Box Selection To Run Report Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jutlaux - 28 May 2008 20:49 GMT
I have a form with a combo box on it where the user can select someone's name
and then hit a button to run a query that just shows records for the selected
person.  That part works just fine, the problem I have is that sometimes you
want to see everyone and I am trying to make so that if the combo box is left
empty everyone is displayed, but if you don't select someone from the combo
box the report is empty when it runs.

Here is the what I have
Form -> "frmProgChangeLogSearch"  with the following on it
    Combo box ->"cboPlantEngineer", which does have the control source empty
    Run query button -> "cmdSearchByName"

Query ->"qryChangeLogMain_Search"
    In this query I have Field "strAssignedTo" that has the criteria
[Forms]![frmProgChangeLogSearch]![cboPlantEngineer]

The cmdSearchByName button code is:

Private Sub cmdSearchByName_Click()
On Error GoTo Err_cmdSearchByName_Click

   Dim stDocName As String

   stDocName = "qryChangeLogMain_Search"
   DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_cmdSearchByName_Click:
   Exit Sub

Err_cmdSearchByName_Click:
   MsgBox Err.Description
   Resume Exit_cmdSearchByName_Click
   
End Sub

Thanks
Tammy F - 28 May 2008 22:32 GMT
This may be an incomplete answer for what you are looking for... but in the
query your criteria could be for the search field:
[Forms]![frmProgChangeLogSearch]![cboPlantEngineer] or
[Forms]![frmProgChangeLogSearch]![cboPlantEngineer] is null

if the combo box is blank - then it will pull all the names.

Tammy

> I have a form with a combo box on it where the user can select someone's name
> and then hit a button to run a query that just shows records for the selected
[quoted text clipped - 32 lines]
>
> Thanks
jutlaux - 29 May 2008 05:12 GMT
This is exaclty what I was looking for.  Thanks!

> This may be an incomplete answer for what you are looking for... but in the
> query your criteria could be for the search field:
[quoted text clipped - 41 lines]
> >
> > Thanks
 
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.