Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287

    I appreciate the help guys. Time to home for me as well.

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I don't use dynamic parameterized queries. I use VBA to build string of filter criteria and apply to form or report when opening.

    These work:

    LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[1-8]", [Forms]![Switchboard]![Store])

    LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[3,6,9]", [Forms]![Switchboard]![Store])

    LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[1-8,9]", [Forms]![Switchboard]![Store])

    But this does not pull in 21:

    LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[1-8,21]", [Forms]![Switchboard]![Store])
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #18
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    You could try this. Take the parameter right out of the query - let the query return all records.

    Then, in the procedure that calls the report, you can do something like this:

    If ComboBox = "ALL" then
    DoCmd.OpenReport "Report_Name", acViewPreview,,"Store_Number in ('01', '02', '03', '04', '05', '06', '07', '08', '21')"
    else
    DoCmd.OpenReport "Report_Name", acViewPreview,,"Store_Number = '" & combobox & "'"
    endif

    replacing the italics with the actual names you have in your database.

    HTH

    John

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Exactly what I was suggesting.

    Or one line with IIf

    DoCmd.OpenReport "Report_Name", acViewPreview, , "Store_Number " & IIf(Me.Store="ALL", "IN (1,2,3,4,5,6,7,8,21)", "=" & Me.Store)

    Is Store_Number a number or text type field?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 04-09-2014, 06:57 PM
  2. Replies: 3
    Last Post: 07-01-2013, 12:31 PM
  3. Hve text combo box values but store integers in field
    By accesshelpasker in forum Access
    Replies: 9
    Last Post: 10-28-2011, 10:49 AM
  4. Two colunms in combo, only store one?
    By Bike in forum Queries
    Replies: 3
    Last Post: 03-30-2011, 10:38 PM
  5. Replies: 1
    Last Post: 01-21-2010, 02:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums