Would somebody be able to help me please,
I am attempting to run a piece of code that has been made in a modual with a public class and want to run it via a macro on a swichboard, but i have tryed the Runcode function but i cannot seem to get it to work this error keeps poping up every time i attempt to run it,
The code i am trying to run is this,
Code:
' Gives the script a name
Public Function customer()
'Tell's the script if there is an error to go to the ErrorHandle function
On Error GoTo ErrorHandle
'Opens the report for customers
DoCmd.OpenReport "Customer Records", acViewPreview
'Does the equivalent of File > Print
DoCmd.RunCommand acCmdPrint
' Close's the report after print job is sent to printer.
DoCmd.Close acReport
'Threads the error handler
ErrorHandle:
' Print's a dialox box if an error occurs that says there was an error and to try again.
MsgBox "A Error Occurred whilst trying to print please try again. "
'Quits the script
Exit Function
'Quit's the IF function above for ErrorHandle
End If
'Ends the script and then wates to be run again from the switchboard
End Function
And this is the error,
Thanks