Hi all,
I have a bound form, the contents of which are simple. 1 bound field where a year may (or may not) be entered.
I have Data Validation on this field (yyyy).
I have the form working to a degree. Here's what I have:
This works well but I would like to add some more functionality.
- There is no option for a user to close the form after realising that the value they've entered already exists.
- If a value is added into txtvintage where it already exists in tbl_vintage, make txt_error visible.
- If a value is typed into txtvintage that violates the Data Validation, suppress Access' error, display a custom error and set the focus back onto txt_vintage.
Thanks for the help.
Dave
I have a bound form, the contents of which are simple. 1 bound field where a year may (or may not) be entered.
I have Data Validation on this field (yyyy).
I have the form working to a degree. Here's what I have:
Code:
Private Sub cmd_closeform_Click()
If IsNull(Me.txtvintage) Then
MsgBox "Please enter a Vintage", , "Enter a Vintage"
Me.txtvintage.SetFocus
Else
MsgBox "The Vintage was saved", , "Record Saved"
DoCmd.Close
End If
End Sub
This works well but I would like to add some more functionality.
- There is no option for a user to close the form after realising that the value they've entered already exists.
- If a value is added into txtvintage where it already exists in tbl_vintage, make txt_error visible.
- If a value is typed into txtvintage that violates the Data Validation, suppress Access' error, display a custom error and set the focus back onto txt_vintage.
Thanks for the help.
Dave