N
Newbie
I'm using Access 2003 connecting to SQL Server 2k via DSN. I'm using a form
to add data to one table. When the user fill-in all the info on the form,
they press the add button and a record is added to a table. Then the focus is
set back to the first field on the form which is CboCommCode. I have the
following code in the On Exit of the CboCommCode to enforce that the field
can not be blank.
Private Sub CboCommCode_Exit(Cancel As Integer)
If IsNull(Me.CboCommCode) Or Me.CboCommCode = "" Then
MsgBox "Community Code is required! Enter community code or select from
list!"
Me.Undo
Cancel = True
End If
End Sub
I also have an Close button to close out the form and the code behind it is:
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
The problem I'm facing is when the user wanting to quit and close the form,
they will have to enter/select a value into a CboCommCode in order to click
the Close button to exit out of the form.
What code do I need if the Close button click, disregard the validation rule
in the CboCommCode. Your help is greatly appreciated.
to add data to one table. When the user fill-in all the info on the form,
they press the add button and a record is added to a table. Then the focus is
set back to the first field on the form which is CboCommCode. I have the
following code in the On Exit of the CboCommCode to enforce that the field
can not be blank.
Private Sub CboCommCode_Exit(Cancel As Integer)
If IsNull(Me.CboCommCode) Or Me.CboCommCode = "" Then
MsgBox "Community Code is required! Enter community code or select from
list!"
Me.Undo
Cancel = True
End If
End Sub
I also have an Close button to close out the form and the code behind it is:
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
The problem I'm facing is when the user wanting to quit and close the form,
they will have to enter/select a value into a CboCommCode in order to click
the Close button to exit out of the form.
What code do I need if the Close button click, disregard the validation rule
in the CboCommCode. Your help is greatly appreciated.