
January 12th, 2005, 12:36 PM
|
|
Registered User
|
|
Join Date: Jan 2005
Posts: 3
Time spent in forums: 29 m 24 sec
Reputation Power: 0
|
|
|
Access Macro - Using action runcode
I have a standard module called test with a function called save_report which executes the OutputTo function with the date and time appended to the file name. What I would like to do is have this code executed from a macro using the runcode action. Right now the code in the module looks like this:
Function Save_Report()
Dim tempDate As String
Dim tempTime As String
Dim fileName As String
tempDate = Format(Date, "yymmdd")
tempTime = Format(Time, "hhnn")
fileName = ".\rpts\test_" & tempDate & "-" & tempTime & ".SNP"
DoCmd.OutputTo acOutputReport, "rBarcodeList", acFormatSNP, fileName, False
End Function
I have a macro that has a number of query actions but the last thing I would like to do is run this code to output a report. I have entered the runcode action and entered the function name into the function field using the query build button. However, when the macro is executed the runcode action does not work and the action failed popup appears.
When I try to put a breakpoint in the code of the module and run the form that runs the macro it seem the program nevers seems to go into the module. Could someone shed some light onto why I may be having this problem.
|