Microsoft Access 2010 VBA - use a macro to pass parameters to VBA
Posted on 2014-02-27
I have this code:
Function store_PDF(rpt As Report, JobNumber As Integer)
Dim folderLoc, Msg, directory As String
Dim sendFile As Boolean
sendFile = False
file_location = "C:\test\" & JobNumber & "\"
If sendFile = False Then
ChooseFile rpt, file_location
If Msg = "" Then Exit Function
If Right(Msg, 1) <> "\" Then Msg = Msg & "\"
file_location = Msg
sendFile = True
If sendFile Then
create_pdf rpt, file_location
which is called by this event on a form:
Private Sub btn_createPDF_Click()
store_PDF Me, Me.Job_ID
But, I would like the above event code (btn_createPDF) to be replaced by a macro. Then I can call that macro by using a button and easily replicate it throughout the system.
How do I replace the event code with a macro, and still pass the parameters please?