Hope someone can correct me here.
I have a form with various text, date and combo controls. There is a button at the button that runs a macro (Close NB) at the bottom. What I'm trying to do is bring up a msgbox if certain fields are blank and not run the macro. I only want the macro to run if all the fields specified have data in them.
The fields are :
cmb_cliname
cmb_disease
cmb_projectType
cmb_ProposalStatus
The on click code is:
If (Me.cmb_cliname Is Null) Then
MsgBox "Please fill in the relevant details",
ElseIf (Me.cmb_Disease Is Null) Then
MsgBox "Please fill in the relevant details"
ElseIf (Me.cmb_ProjectType Is Null) Then
MsgBox "Please fill in the relevant details"
ElseIf (Me.Cmb_ProposalStatus Is Null) Then
MsgBox "Please fill in the relevant details"
Else: DoCmd.RunMacro CloseNB
End If
End If
End If
End If
Please let me know if I need to clarify further.
Any help appreciated.
Thanks
I have a form with various text, date and combo controls. There is a button at the button that runs a macro (Close NB) at the bottom. What I'm trying to do is bring up a msgbox if certain fields are blank and not run the macro. I only want the macro to run if all the fields specified have data in them.
The fields are :
cmb_cliname
cmb_disease
cmb_projectType
cmb_ProposalStatus
The on click code is:
If (Me.cmb_cliname Is Null) Then
MsgBox "Please fill in the relevant details",
ElseIf (Me.cmb_Disease Is Null) Then
MsgBox "Please fill in the relevant details"
ElseIf (Me.cmb_ProjectType Is Null) Then
MsgBox "Please fill in the relevant details"
ElseIf (Me.Cmb_ProposalStatus Is Null) Then
MsgBox "Please fill in the relevant details"
Else: DoCmd.RunMacro CloseNB
End If
End If
End If
End If
Please let me know if I need to clarify further.
Any help appreciated.
Thanks