Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008
    Posts
    10

    Unanswered: "All" Option in Combo Box

    I have a report that has a record source of: qryEventInfoByRegion/Date

    I have a parameters form with a comboBox titled: ChooseType and a text box for StartDate and End Date
    The record source for the combo box is: SELECT "*" AS Type_ID, "ALL" AS Type, 0 AS SortOrder FROM tblType UNION SELECT Type_ID, Type, 1 FROM tblType ORDER BY SortOrder, Type;

    It has 2 bound columns and a column count of 2 and column widths of: 0";4"

    On that form I have a button: cmdRunRpt
    That currently has an OnClick Event of:
    DoCmd.OpenReport "rptEventInfoByType/Date", acPreview, , "Type LIKE '" & Me.ChooseType & "*'AND [EventDate] Between #" & Me.[StartDate] & "# AND #" & Me.[EndDate] & "#"

    This arrangement gives me a great report when I choose a type in the combo, but when I choose "All" I get a report without data.

    What am I missing?

    Thanks

  2. #2
    Join Date
    May 2008
    Location
    Raleigh, NC
    Posts
    151

    Probably...

    DoCmd.OpenReport "rptEventInfoByType/Date", acPreview, , "Type LIKE '" & Me.ChooseType & "*'AND [EventDate] Between #" & Me.[StartDate] & "# AND #" & Me.[EndDate] & "#"

    I think the above line adds the filter "where Type LIKE 'All*' and obviously 'All' is not a valid type.

    You'll have to figure out some code so when 'All' is chosen you only pass the '*'.

    Good luck.
    --If its free, take it for what its worth!

  3. #3
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    "Type LIKE '" & replace(Me.ChooseType ,"All","")

    Should do it buddy - let me know.
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  4. #4
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    Oh! As long as 'All' does not feature in any of the other category names...
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •