Hello everybody.
I'm so stuck! It's most likely very simple, but I'm tearing my hair out here.
On the On Click command of a command button to open a form, I want a MsgBox to appear (which is does) and if OK is clicked, then I want it to open the Information Manager's form, else, when they click on Cancel, it stays where it is (ie, stays on the same form). However, at the moment, whether I click OK or Cancel, it goes to the Information Manager's form.
Here is my code (basic as it is!):
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Information Management"
MsgBox "If you are NOT the Information Manager, then please click on Cancel", vbOKCancel, "C R I T I C A L !!"
If vbOKCancel = vbCancel Then DoCmd.Close
Else: DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Command26_Click:
Exit Sub
Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click
End Sub
Any help would be SO gratefully received.
Kind regards,
sparkes84
I'm so stuck! It's most likely very simple, but I'm tearing my hair out here.
On the On Click command of a command button to open a form, I want a MsgBox to appear (which is does) and if OK is clicked, then I want it to open the Information Manager's form, else, when they click on Cancel, it stays where it is (ie, stays on the same form). However, at the moment, whether I click OK or Cancel, it goes to the Information Manager's form.
Here is my code (basic as it is!):
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Information Management"
MsgBox "If you are NOT the Information Manager, then please click on Cancel", vbOKCancel, "C R I T I C A L !!"
If vbOKCancel = vbCancel Then DoCmd.Close
Else: DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Command26_Click:
Exit Sub
Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click
End Sub
Any help would be SO gratefully received.
Kind regards,
sparkes84