Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 36
  1. #16
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60

    Got it to work (good enough). Thanks!

  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60
    Ok, I thought everything was working properly. I am outputing the report as a PDF and that works fine, but I wanted to hide the previewed report as there is no need to see it AND the pdf. So I used the acHidden function but I cant seem to get it configured properly. What I read has it with several commas with spaces and me being the VB noob that I am, I have no idea what they mean. When I tried various numbers of commas and spaces, sometimes the previewed report would be hidden, other times it wouldnt. The line looks like this:

    DoCmd.OpenReport "rptWeeklyUpdate", acPreview, , "Branch_ID IN(" & strWhere 7 ")"

    The list box selection of "Branch_ID" has 3 selections in a variety of combinations. When I put int he acHidden function, the report would end up not outputing the correct information based upon the selection.

    I really want to hide the report, but its more important to output the correct information. Do you know where/how I should add the acHidden?

    Thanks again!

  4. #19
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60
    Ok, I thought everything was working properly. I am outputing the report as a PDF and that works fine, but I wanted to hide the previewed report as there is no need to see it AND the pdf. So I used the acHidden function but I cant seem to get it configured properly. What I read has it with several commas with spaces and me being the VB noob that I am, I have no idea what they mean. When I tried various numbers of commas and spaces, sometimes the previewed report would be hidden, other times it wouldnt. The line looks like this:

    DoCmd.OpenReport "rptWeeklyUpdate", acPreview, , "Branch_ID IN(" & strWhere & ")"

    The list box selection of "Branch_ID" has 3 selections in a variety of combinations. When I put int he acHidden function, the report would end up not outputing the correct information based upon the selection.

    I really want to hide the report, but its more important to output the correct information. Do you know where/how I should add the acHidden?

    Thanks again!

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If you look in VBA help at OpenReport you should see the correct order of arguments. You should also be getting intellisense as you type the code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60
    From what I have read and looking through the intellisense, the "acHidden" command should be the 5th argument. But whenever I use it, it screws up the selection (multi-value list box) and outputs the wrong information.

    So I tried the "Visible = False argument like: Reports("rptWeeklyUpdate").Visible = False. This hides the print preview but doesnt output the correct information based upon the multi-value list box.

    Sigh.

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It would help to see your code that fails. It sounds like you have the right position, but it shouldn't affect the wherecondition. Of course, if you open it, send it and then close it, the user will probably just see a flicker. When emailing I'm more likely to use this method of filtering to save the overhead of opening and closing the report:

    Emailing a different report to each recipient

    Can you post a sample db that exhibits the problem?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60
    The db is on a network that I cant easily transfer from. 9-( Basic Outline: - Weekly Updates collected from people in 3 different Branches - Report generated for management based upon their selection of which Branches (in the multi-select list box) - Report is based upon a date range and selected Branches that use a Query which feeds the final Report - I used your code for the multi-select list box which works great - When a user clicks the button to output the report based upon the given parameters, it shows the print preview version of the report and then a PDF opens up with the same information I just want the print preview of the report to not show up. 9-( Thanks again for your help!

  9. #24
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I understand what you want to happen, just in my experience the hidden argument doesn't interfere with the wherecondition argument.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60
    I tried adding both (separately) acHidden and visible = false lines into your MultiSelect Sample and I had the same problems as with my DB. 9-(

    Any suggestions?

    Thanks again for all of your help!

  11. #26
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    What does the code with acHidden look like?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #27
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60
    DoCmd.OpenReport "rptEmployees", acPreview, , "EmpID IN(" & strWhere & ")", acHidden

    Happy Friday!

  13. #28
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'm stumped then, because that looks correct. Adding acHidden shouldn't affect the filtering if it works correctly without it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #29
    Moridan is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Apr 2013
    Posts
    60
    Then if you are stumped then I'm stumped. 9-(

    Have you tried it with your multi-select code?

  15. #30
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Yes, modifications worked as expected:

    DoCmd.OpenReport "rptEmployees", acPreview, , "EmpID IN(" & strWhere & ")", acHidden
    DoCmd.SendObject acSendReport, "rptEmployees", acFormatPDF, "pbaldy@test.com"
    DoCmd.Close acReport, "rptEmployees"

    The report in the email was properly filtered.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 03-23-2013, 03:13 PM
  2. Replies: 2
    Last Post: 02-21-2013, 07:47 AM
  3. Multiple Selection wth List Box / Combo Box
    By rkalapura in forum Forms
    Replies: 11
    Last Post: 02-09-2013, 11:02 PM
  4. Replies: 7
    Last Post: 10-16-2012, 06:43 PM
  5. Multiple record selection on list box?
    By looloo in forum Forms
    Replies: 2
    Last Post: 09-22-2011, 05:52 PM

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