C
CJ
Hi Groupies
I am not very good with code so I am not sure what the error message is
referring to:
I have created a function and I would like it to run when a user pushes a
button on the switchboard. With the switchboard manager, I used the command
to make code run and then entered the name of my function as ExpiryCheck().
When I push the button, I get the message "There was an error executing the
command"......very helpful!!
I have used this code before, but only via a command button on a form, never
through the switchboard.
I think that perhaps my code is not declared properly.....it is as follows:
Public Function ExpiryCheck()
Dim stDocName As String
'Expiry Check takes a while, display form while waiting
DoCmd.OpenForm "frmExpiryStatus"
'Expiry Check
stDocName = "rptExpiry"
DoCmd.RepaintObject acForm, "frmExpiryStatus"
If IsNull(DLookup("IDNumber", "qryExpiry")) Then
DoCmd.Close acForm, "frmExpiryStatus"
MsgBox "No Pending Renewals. Report Preview Cancelled",
vbInformation, "Training Manager"
Else
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.Maximize
DoCmd.Close acForm, "frmExpiryStatus"
MsgBox "Pending Expiration Dates Require Your Attention!",
vbCritical, "Training Manager"
End If
End Function
Thanks for the insight!
I am not very good with code so I am not sure what the error message is
referring to:
I have created a function and I would like it to run when a user pushes a
button on the switchboard. With the switchboard manager, I used the command
to make code run and then entered the name of my function as ExpiryCheck().
When I push the button, I get the message "There was an error executing the
command"......very helpful!!
I have used this code before, but only via a command button on a form, never
through the switchboard.
I think that perhaps my code is not declared properly.....it is as follows:
Public Function ExpiryCheck()
Dim stDocName As String
'Expiry Check takes a while, display form while waiting
DoCmd.OpenForm "frmExpiryStatus"
'Expiry Check
stDocName = "rptExpiry"
DoCmd.RepaintObject acForm, "frmExpiryStatus"
If IsNull(DLookup("IDNumber", "qryExpiry")) Then
DoCmd.Close acForm, "frmExpiryStatus"
MsgBox "No Pending Renewals. Report Preview Cancelled",
vbInformation, "Training Manager"
Else
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.Maximize
DoCmd.Close acForm, "frmExpiryStatus"
MsgBox "Pending Expiration Dates Require Your Attention!",
vbCritical, "Training Manager"
End If
End Function
Thanks for the insight!