VBA Report Module Auto populate "save as" name

Gasman and Buddha

Thanks for your help... I will look into those videos...
 
Come back when you have a little more foundation to work with. Those videos are going to save you a whole lot of grief in the future. :)

I also still Google the syntax for commands like that. Once you know the command then Intellisense can kick in.
Also make sure you always have Option Explicit at the top of your rmodules. best to set in VBE window/Tools/Oprions/Require Variable Declaration.
 
I would recommend commenting out the "on error" line completely. The breakpoints are a fine idea but you won't even need those if you comment out the "on error goto" line completely. Then the code will go into debug mode directly on the line where the error is. Once that happens, click Debug. Then view the Immediate window (View, Immediate window), and you can start practicing some of the debugging techniques (such as asking the immediate window a question, such as ?varname.value (and hit Enter) ........ FWIW
 
wouldn't this line:
strRptName = Forms![Specific_Information_frm]![WBS Number] & " " & "Ultrasonic Report"
...be returning only a potential file name? or does it contain a folder path too? Seems like it probably does not contain a folder path.... but again, ask the immediate window that question while debugging.
 
Seems to me that the OP is wanting to have a different PDF document for different items.

Using the docmd.outputTo does not provide for any filtering on the record source for the report. When I have this type of requirement, I base the report on a query and modify the SQL of an existing query to filter the data required. Alternatively, the report could be based on a temporary table which is populated with the required record(s).
 
Gasman and Buddha

Thanks for your help... I will look into those videos...
You could take what you might think is a step backwards.
Hard code the report and output filename to at least get it working correctly. Only then start replacing hard coded values with variables.

I believe you are confusing the report name and output filename. The report should really be the same report just with different criteria for it's source.
The filename would likely be a different name taking into account the WBSNumber.?
As mentioned the source for the report is hopefully taken into account with the WBSNumber on the form, perhaps by having that control as criteria in the query.?
 
I would recommend commenting out the "on error" line completely. The breakpoints are a fine idea but you won't even need those if you comment out the "on error goto" line completely. Then the code will go into debug mode directly on the line where the error is. Once that happens, click Debug. Then view the Immediate window (View, Immediate window), and you can start practicing some of the debugging techniques (such as asking the immediate window a question, such as ?varname.value (and hit Enter) ........ FWIW
Yes, this is SOP to debug code.
 

Users who are viewing this thread

Back
Top Bottom