Discussion Locked

Access BeforeUpdate event fires too soon

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am inputting a new record on a screen whose data source is just one table. There are in the VB some Recordset references to other tables, but the referring control on the screen is unbound. When I have input 6 items, starting with the index and only required item, control enters the Form_BeforeUpdate procedure, although there are further controls on the screen for the record. It does not matter whether tabbing is to one of the further controls, to a combo box on another table(using the index from this screen) or to a subform contining two controls for this table.
How do I arrange that the BeforeUpdate event be triggered only when the user has entered all the items, or at least passed through them?

6 replies

by stillatit

The problem is that when you change the value of a bound control, it updates the record immediately. To do what you want to do you would have to use all unbound controls (local variables), and have an "Update" button that updated the record.

Goodluck.

by john_wills

This does not really help me in the current problem, but it is a good idea and a useful enhancement of my consciousness.

by john_wills

Stillatit's remarks seem to fit what I have been learning otherwise. Not all things can be said in all languages.

by sl-campbell

Try setting a module level boolean, bDoNotUpdate, to True until you are ready to update the bound control, or when it gets focus, and then set it to false. In the Before_Update event, check if it is true, and if so then set the events Cancel to trueand exit the sub.

by john_wills

This too enlarges my consciousness. My real problem was that I was doing things BeforeUpdate that really belonged AfterUpdate.

This discussion is closed to new replies.