I'm unsure if I sent this already but my thread history tells me I failed to send. However, could someone assist with an effective way of doing the above. I have looked through FAQ's, searched through this site and looked on Microsoft's help site, but stil I'm confused. The following procedure, which I know is not right, does not seem to fit the bill:
The upshot is: 1. The three required fields on this form should be tested for " " (I assume rather than null). 2. If not " " the form can be closed and the new record saved. 3. If any are " " then focus on each to give the option to input data and then close. I realise this code is only if best part way there but can someone nudge me in the right direction.
I should be most grateful.
Ted.
Code:
Private Sub Label26_Click()
On Error GoTo Err_CloseForm_Click
If IsNull(Me!DeptPrefixcbo1) And IsNull(Me!ProductIDcbo) And IsNull(Me!aRIDcbo) Then
MsgBox "All fields on this form are required"
Exit Sub
ElseIf IsNull(Me!DeptPrefixcbo1) Then
MsgBox "Dept Prefix must be added", vbExclamation
Me!DeptPrefixcbo1.SetFocus
ElseIf IsNull(Me!ProductIDcbo) Then
MsgBox "Product must be added", vbExclamation
Me!ProductIDcbo.SetFocus
ElseIf IsNull(Me!aRIDcbo) Then
MsgBox "Area Responsibility must be added", vbExclamation
Me!aRIDcbo.SetFocus
Else
DoCmd.Close
End If
Exit_CloseForm_Click:
Exit Sub
Err_CloseForm_Click:
MsgBox Err.Description
Resume Exit_CloseForm_Click
End Sub
The upshot is: 1. The three required fields on this form should be tested for " " (I assume rather than null). 2. If not " " the form can be closed and the new record saved. 3. If any are " " then focus on each to give the option to input data and then close. I realise this code is only if best part way there but can someone nudge me in the right direction.
I should be most grateful.
Ted.