Got it to work (good enough). Thanks!
Got it to work (good enough). Thanks!
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!
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!
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.
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.
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?
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!
I understand what you want to happen, just in my experience the hidden argument doesn't interfere with the wherecondition argument.
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!
What does the code with acHidden look like?
DoCmd.OpenReport "rptEmployees", acPreview, , "EmpID IN(" & strWhere & ")", acHidden
Happy Friday!
I'm stumped then, because that looks correct. Adding acHidden shouldn't affect the filtering if it works correctly without it.
Then if you are stumped then I'm stumped. 9-(
Have you tried it with your multi-select code?
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.