IanT
12-14-2001, 04:20 AM
I want a message to appear if no data is recorded in a field. The message is to appear when the field is out of focus. Can anyone help!
|
View Full Version : Prompt in form IanT 12-14-2001, 04:20 AM I want a message to appear if no data is recorded in a field. The message is to appear when the field is out of focus. Can anyone help! Hayley Baxter 12-14-2001, 04:50 AM create a macro called msgbox then in the properties behind your combobox add this macro to not in list event. Hope this helps wh00t 12-14-2001, 04:51 AM Here's a basic code that'll do it Private Sub ProductName_LostFocus() If IsNull(FieldName) Then MsgBox ("Field is blank, you must enter data"), vbExclamation End If End Sub Pat Hartman 12-16-2001, 05:26 PM This won't work very well since the user would have had to place the cursor into the field at some point in order to trigger the error message. A better place to trap errors of this type is the FORM's BeforeUpdate event. If you find any errors or missing data, you can cancel the update event so the record won't get saved/updated, and place the cursor in the first field that raised an error. If you leave the edit check in the LostFocus event, the user will be able to blow by the error (assuming it is raised at all) and save the record anyway unless the field is set as required in the table definition. |