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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catching data entry errors

Status
Not open for further replies.

DLG

Programmer
Sep 21, 1999
4
US
I have a data entry form with fields like date, clientID, etc and a subform to collect data on a particular "visit". I want to be able to catch when the user forgets to enter data in a particular field on the main form before tabbing into the subform. If there are missing fields I want to return focus to the date (or first field on the main form) along with a message telling them to correct the entry. What is the standard practice for accomplishing this? Should this be in the table validation? or field by field?
Thank you
 
well... you can use the OnEnter sub on the subform control, and check to make sure that all of the fields you want information on are filled.

Code:
private sub MySubForm_Enter()
    if isnull(me.txtdate) then
        me.txtdate.setfocus
    endif
'enter other field checks here

end sub

This should work, but there may be a better way to do it.
 
For the main form, you can place your validation/business rule in the After_update event of each control.

Then when the user attempts to save the changes, you can call these After_Update events in your Form_AfterUpdate event. Actually, I have not done it that way. However, I can see potential problems if not coded properly.

Gary
gwinn7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top