Reputation: 1
I have a macro that runs a series of steps and outputs a report in MS Acces.s I want this report to be named using a variable from my form and stored in a particular file.
I have written VB code to do the same.
It runs perfectly well when i run the code, but from the macro it doesn't work!
Private Sub FileLocator()
If [Forms]![Date Form].[Frame37] = 1 Then
MsgBox ("Working")
x = [Forms]![Date Form].List29
Else
x = [Forms]![Date Form].List25
End If
DoCmd.OutputTo acOutputReport, "41_Webtime less than 40 hours chart", "PDFFormat(*.pdf)", "C:\" & x & "\" & x & ".pdf", True, "", , acExportQualityPrint
End Sub
From my macro i call Forms![Date Form]!FileLocator
in RunCode
Upvotes: 0
Views: 755
Reputation: 63
Just had this issue myself, turns out you cannot have the module name the same as the function name.
Hope that is your issue as well.
Upvotes: 1