Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run check before leaving record

Status
Not open for further replies.

yoshe

Technical User
Jan 12, 2007
36
US
Hello,
I have a bound form with bound subforms on tabbed pages. I have a field on the main parent form "Application_Status" that I want to check for null, but only before leaving the record. My initial attempt was to use the form's BeforeUpdate event, but this causes it to run (and pop up my message that the field is required) when the user moves to a child record, and before he really has the information to be able to fill the "Application_Status" field. Any suggestions on what event to use? Searching through the postings some people have mentioned a RecordExit event for forms, but this doesn't seem to exist. ??? Thanks for any help.
 
Is using a button to move to the next record an option for you?
 
What kind of control is it? If it's a TextBox, then you might try reading its text property rather than its value.

If Len(Nz(Me!txtTextBox.Text, vbNullString)) > 0 Then
'Do something
End If
 
Possibly, but I didn't really want to get rid of the navigation buttons at the bottom - people are used to those for scrolling back and forth, sorting on some field and then going to first or last record, etc. The form is used for ongoing edits (during which time they might accidentally blank out the Application_Status field), not just initial data entry.
 
DrGreg1408
You can only check the text property when a control has focus. I can't quite see how this would work as a check before the user moves to the next main record.
 
DrGreg1408, it is a combobox, but my problem is not that the check is not working, but that the event fires too often (ie, when moving between parent and child records rather than just when leaving the parent record).
 
You could do something fiddly with a form level variable. Set it to the ID of the record in the After Update event of Application_Status and check it in the current event, if it equals a record, return to that record and clear the variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top