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

Form Data entry Question

Status
Not open for further replies.

Ray1127

Programmer
Feb 22, 2002
231
US
I have a form with a number of fields. There is a type field that depending on the type selected some fields are appropriate and others are not. I have all of that working. The problem is that if the user changes the type the non-appropriate fields are hidden but the data still exists. I want to validate so that when the type changes the user is given a warning and forced to remove the data from those fields. That all works the problem I'm having is that the type (a combobox) still changes How do I stop it from changing until all of the fields are blanked out?
 
on the before update of the type combo box do your checking and if wrong fields are filled

msgbox "wrong fields filled please edit"
cancel = true
exit sub
 
As PWise suggested, you've probably got your code in the after_update event rather than before_update event. Swap that around, add in the cancel = true, and that part will be set.

What I'd wonder is would you rather just clear the fields automatically via code when the type is changed (and the user acknowledges the warning that the previous data will be erased?

It'd be more work up front, but the user would have less work to do, and they wouldn't have to look and make sure they cleared the correct fields.
 
How are ya Ray1127 . . .
kjv1611 said:
[blue]What I'd wonder is would you rather just clear the fields automatically via code when the type is changed (and the user acknowledges the warning that the previous data will be erased?[/blue]
I could'nt agree more. Makes a much better interface! [thumbsup2]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Actually I couldn't agree more but my boss will not allow it. No clue as to why. He want's the user to have to clear it out.

It was in the before update event. But it's no longer relevant other priorities have put that DB on the back burner for at least a month. Thanks anyways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top