I have a function tha I have written which I am trying to run from a macro using Runcode. The macro that I am trying to call the function from is the OnClick event of a command button. Basically, I want to print a different page of my reort dependent upon the value in the text control "Text28." But when I press the button, the code is function is not running and I can't figure out why. Any suggestions would be very much appreciated! Here is what I have for the function:
Code:
Public Function PrintOut()
If Text28 = "aaa" Then
DoCmd.PrintOut acPages, 2, 2, , 1
ElseIf Text28 = "bbb" Then
DoCmd.PrintOut acPages, 3, 3, , 1
ElseIf Text28 = "ccc" Then
DoCmd.PrintOut acPages, 4, 4, , 1
ElseIf Text28 = "ddd" Then
DoCmd.PrintOut acPages, 5, 5, , 1
End If
End Function
Comment