Dear All,
I am having a problem dealing with macro. Here's the scenario: If a user logs to my database and has no outstanding task, I want the frmGeneral form to close and return to the main switchboard. The problem occurs when the user opens the frmGeneral again, the system pops up a dialog box with the following error:
Action Failed
Macro Name: mcLoginFilterCurUser
Condition: True
Action Name: RunCommand
Arguments: 2
How can I prevent this error? I just want the system to pop up a message "You have no outstanding task" only, irregardless how many times the user opens the frmGeneral.
Here's my code:
Thanks in advance.
Regards,
qwerty70
I am having a problem dealing with macro. Here's the scenario: If a user logs to my database and has no outstanding task, I want the frmGeneral form to close and return to the main switchboard. The problem occurs when the user opens the frmGeneral again, the system pops up a dialog box with the following error:
Action Failed
Macro Name: mcLoginFilterCurUser
Condition: True
Action Name: RunCommand
Arguments: 2
How can I prevent this error? I just want the system to pop up a message "You have no outstanding task" only, irregardless how many times the user opens the frmGeneral.
Here's my code:
Code:
Private Sub Form_Open(Cancel As Integer)
If (Me.txtAccessType = 3) And (Me.Recordset.RecordCount = 0) Then
MsgBox "You have no Outstanding Task.", vbOKOnly, "Task Assignment Status"
Else
DoCmd.RunMacro "mcLoginFilterCurUser"
DoCmd.OpenForm "frmGeneral", , "qryGeneral_FilterCurrentUser"
End If
End Sub
Thanks in advance.
Regards,
qwerty70