Hi
I have a form containing a subform. There are certain fields I want to check are completed before the record is saved. If they are not complete the user is taken back to that field.
I have used the following code behind the save and Exit Button:
If IsNull(Me!Combo116) Then
MsgBox "Please enter a valid Project Number"
Me.Combo116.SetFocus
Else
If IsNull(Me!Cb_Cat) Then
MsgBox "Please enter a valid Category"
Me.Cb_Cat.SetFocus
Else
If IsNull(Me!Combo23) Then
MsgBox "Please enter a valid Location"
Me.Combo23.SetFocus
Else
If IsNull(Forms!Fm_Risk_ass.Fm_Chosen.Form!Combo11) Then
MsgBox "Please Ensure you have Selected the Chosen Option "
Me!Fm_suboptions.SetFocus
Else
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close
End If
End If
End If
End If
It works for the first two cases - but not the last two - although it has worked for all options in the past - it seems to have stopped working and I don;t know why - can anyone help please?.
I have a form containing a subform. There are certain fields I want to check are completed before the record is saved. If they are not complete the user is taken back to that field.
I have used the following code behind the save and Exit Button:
If IsNull(Me!Combo116) Then
MsgBox "Please enter a valid Project Number"
Me.Combo116.SetFocus
Else
If IsNull(Me!Cb_Cat) Then
MsgBox "Please enter a valid Category"
Me.Cb_Cat.SetFocus
Else
If IsNull(Me!Combo23) Then
MsgBox "Please enter a valid Location"
Me.Combo23.SetFocus
Else
If IsNull(Forms!Fm_Risk_ass.Fm_Chosen.Form!Combo11) Then
MsgBox "Please Ensure you have Selected the Chosen Option "
Me!Fm_suboptions.SetFocus
Else
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close
End If
End If
End If
End If
It works for the first two cases - but not the last two - although it has worked for all options in the past - it seems to have stopped working and I don;t know why - can anyone help please?.