Question

Locked

Field Validation - Access 2007

By jgitter ·
I have a form field called "claim number" that must be entered before a user can continue to add a new record using a multi-tab form. I'm using the on lost focus event of the text box to ensure they enter a value. I also want to enable a user to cancel an update and close the form using a command button, which if can't do using the lost focus event. Any suggestions on what textbox event I should use to validate data entry? I want to validate that something has been entered before they move to another field or tab but also give them the ability to cancel and close the form.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

You'd normally do that sort of thing

by Tony Hopkinson In reply to Field Validation - Access ...

in an onleave event.

Save you self a world of hurt.
put a form in to collect claim number enable OK and that passes it in to your current form and displays it read ony if required.

Other options would be
Can you check waht has focu and then skip the validation e.g

If ((!CancelButton.HasFocus) && (InvalidClaimNumber))
Showerror("You must enter a valid claimNumber")
ClaimNumberBox.Focus

Or some such.

to write your validation and call it (except on Cancel button etc) when that gains focus if it , fails show a dialog or something and the put the focus back to teh claim number box.

Careful how you do this sort of thing, lost focus can be fired when you switch application, or show a dialog and such. Sometime windows just swalows it and never fires the event as well.

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums