I currently have two forms where you enter info into them. You first have to fill out the first form, before you can proceed to the second form. I want a button on this second form that the user can select if they decide that the want to "exit without saving"..... I have code currently set up as follows:
Private Sub exit_without_saving_Click()
Dim strMsg As String, strTitle As String, strFirstForm As String
Dim intResponse As Integer
strMsg = "You Chose to Cancel This Entry." & vbNewLine & vbNewLine & _
" Are You Sure?"
strTitle = "Are You Sure?"
intResponse = MsgBox(strMsg, vbQuestion + vbYesNo, strTitle)
strFirstForm = "Enter a New Clearance Form"
If intResponse = vbYes Then
Me.Undo
DoCmd.Close
GoTo strFirstForm
....SetFocus...?????
.....Delete current record.....
DoCmd.Close
End If
End Sub
The code works for me up until the part in red. With the part in red, I want to be able to setfocus (?) to the first form undo the record there and close that first form... All of this hopefully in that one button on the second form. I know that "undo" is probably not going to work, since the record has been saved, so I need to delete it.... or something along those lines. Does anyone have any suggestions?

Private Sub exit_without_saving_Click()
Dim strMsg As String, strTitle As String, strFirstForm As String
Dim intResponse As Integer
strMsg = "You Chose to Cancel This Entry." & vbNewLine & vbNewLine & _
" Are You Sure?"
strTitle = "Are You Sure?"
intResponse = MsgBox(strMsg, vbQuestion + vbYesNo, strTitle)
strFirstForm = "Enter a New Clearance Form"
If intResponse = vbYes Then
Me.Undo
DoCmd.Close
GoTo strFirstForm
....SetFocus...?????
.....Delete current record.....
DoCmd.Close
End If
End Sub
The code works for me up until the part in red. With the part in red, I want to be able to setfocus (?) to the first form undo the record there and close that first form... All of this hopefully in that one button on the second form. I know that "undo" is probably not going to work, since the record has been saved, so I need to delete it.... or something along those lines. Does anyone have any suggestions?