T
thefonz37
So I have a form ("frm_Manage_Exceptions") with a listbox on it. When you
click on one of the items, it brings up a new form ("frm_Exception_Entry") in
which you can edit the item. When you are done editing, you click on a
hyperlink to close the editing form and return to the original form.
Ultimately, what I'd like to have happen is for there to be a prompt before
closing the editing form that contains the content of the form, so the user
can confirm whether or not the information is correct. Here's the code I
have for that:
Private Sub Label36_Click()
If Me.Dirty Then
msgResult = MsgBox("Please confirm that you will be using " &
cboExceptionType.Column(1) & " from " & _
start_time & " to " & end_time & " on " & date & ".", vbOKCancel)
If (msgResult = vbOK) Then
DoCmd.Close acForm, "frm_Exception_Entry"
Else: End If
Else
DoCmd.Close acForm, "frm_Exception_Entry"
End If
End Sub
Everything works fine, except for the fact that if you click "Cancel" in the
message box, it leaves the editing form open, as intended, but sends it to
the background, moving the form with the listbox on it to the front. It's a
little thing, but ultimately it negatively impacts the flow of the
application.
Any ideas why it's not working correctly?
click on one of the items, it brings up a new form ("frm_Exception_Entry") in
which you can edit the item. When you are done editing, you click on a
hyperlink to close the editing form and return to the original form.
Ultimately, what I'd like to have happen is for there to be a prompt before
closing the editing form that contains the content of the form, so the user
can confirm whether or not the information is correct. Here's the code I
have for that:
Private Sub Label36_Click()
If Me.Dirty Then
msgResult = MsgBox("Please confirm that you will be using " &
cboExceptionType.Column(1) & " from " & _
start_time & " to " & end_time & " on " & date & ".", vbOKCancel)
If (msgResult = vbOK) Then
DoCmd.Close acForm, "frm_Exception_Entry"
Else: End If
Else
DoCmd.Close acForm, "frm_Exception_Entry"
End If
End Sub
Everything works fine, except for the fact that if you click "Cancel" in the
message box, it leaves the editing form open, as intended, but sends it to
the background, moving the form with the listbox on it to the front. It's a
little thing, but ultimately it negatively impacts the flow of the
application.
Any ideas why it's not working correctly?