L
lmcc via AccessMonster.com
I created the code below to do the following:
1. Check to see if me.cboAgency is visible.
2. If it is visible, then check for null.
3. If null, then display a message requesting data.
4. Then set focus to cboAgency field so I can enter the Agency name.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.cboAgency.Visible = False Then
Else
If Me.cboAgency.Visible = True Then
If (IsNull(Me.cboAgency)) Then
MsgBox "You must provide the Agency name.",
vbOKOnly, _
"ETA - Required Field"
Me.cboAgency.SetFocus
Cancel = True
Exit Sub
End If
End If
End If
End Sub
The problem is that after the message is displayed and I hit the OK button,
the form closes instead of setting the focus to me.cboAgency.
Any ideas of what I am missing?
Thanks for your help!
1. Check to see if me.cboAgency is visible.
2. If it is visible, then check for null.
3. If null, then display a message requesting data.
4. Then set focus to cboAgency field so I can enter the Agency name.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.cboAgency.Visible = False Then
Else
If Me.cboAgency.Visible = True Then
If (IsNull(Me.cboAgency)) Then
MsgBox "You must provide the Agency name.",
vbOKOnly, _
"ETA - Required Field"
Me.cboAgency.SetFocus
Cancel = True
Exit Sub
End If
End If
End If
End Sub
The problem is that after the message is displayed and I hit the OK button,
the form closes instead of setting the focus to me.cboAgency.
Any ideas of what I am missing?
Thanks for your help!