No error but it is either to much code or at least mixing code together and not getting the desired results.
I want to click on my command and:
if Me.To IsNnull
[have a message saying you must enter .....]
[another message asking to exit without saving]
If no, continue on main form
If yes, exit
When clicking command again (assuming I entered a value above)
[run above], if true then
If subform value [FileNo] IsNull
MsgBox, click ok, focus back to main form
When clicking command again (assuming I entered both values above)
[run above], if true then
If Not IsNull [above]
save and close
Right now it meshes everything together with all three messages boxes one after another. I enter values, click the command, and nothing happens.
Suggestions?
I want to click on my command and:
if Me.To IsNnull
[have a message saying you must enter .....]
[another message asking to exit without saving]
If no, continue on main form
If yes, exit
When clicking command again (assuming I entered a value above)
[run above], if true then
If subform value [FileNo] IsNull
MsgBox, click ok, focus back to main form
When clicking command again (assuming I entered both values above)
[run above], if true then
If Not IsNull [above]
save and close
Right now it meshes everything together with all three messages boxes one after another. I enter values, click the command, and nothing happens.
Code:
Private Sub Command8_Click()
Dim strWhere As String
Dim response As Integer
'If IsNull (Me.Field) Then
If IsNull(Me.To) Then
MsgBox "You must select a Transfer To Destination!", vbOKOnly, "Input Required"
response = MsgBox(prompt:="Do you want to Exit without saving?", buttons:=vbYesNo)
If response = vbYes Then
DoCmd.Close
Exit Sub
End If
'If IsNull (Forms!MainFormName!SubFormName.Form.Field) Then
If IsNull(Forms!I216!I216Details.Form.FileNo) Then
MsgBox "You must enter an A or T File Number!", vbOKOnly, "Input Required"
End If
Else
If Not IsNull(Me.To) And (Forms!I216!I216Details.Form.FileNo) Then
DoCmd.Save
DoCmd.Close
End If
End If
End Sub
Suggestions?