Folks,
This by no means is a very critical problem. It's more annoying than anything else as it doesn't impact the user, just the developer (me!). LOL
Using Access 2010 on Win7 Pro box.
On my form I have a BeforeUpdate event. Whenever I try switching from the active form to design mode, the BeforeUpdate event is triggered and the message indicates that the "expression refers to an object that is closed or doesn't exist". The expression is testing if data was entered into some of the controls using the Me construct for the controls. If new data is being input, I want to ensure that certain fields are filled in as well.
If all I've done is open the form, change nothing and attempt to move to design mode, I get that error. So I've put some Debug.Print text in both the OnCurrent and BeforeUpdate events identifying the event and the status of the Dirty parameter.
If I move the record in the active form to the next record, I get the following info in the Immediate window:
If I don't move to another record after first opening the form and attempt to move to design mode, I get the following in the Immediate window:
Additionally, when this happens, the Debug.Print line is executed in the BeforeUpdate event (it's the first line of code in the event). The Debug.Print contains the Me.Dirty parameter. Yet the very next line of code which contains the Me.[control] If statement is where the cursor stops when I ask to Debug the error.
I'm confused as to why in the first circumstance the OnCurrent reports False for Dirty while the BeforeUpdate reports True.
Again, this only affects me when designing. It's not an issue for the user.
Any thoughts?
Thanks,
Vic
This by no means is a very critical problem. It's more annoying than anything else as it doesn't impact the user, just the developer (me!). LOL
Using Access 2010 on Win7 Pro box.
On my form I have a BeforeUpdate event. Whenever I try switching from the active form to design mode, the BeforeUpdate event is triggered and the message indicates that the "expression refers to an object that is closed or doesn't exist". The expression is testing if data was entered into some of the controls using the Me construct for the controls. If new data is being input, I want to ensure that certain fields are filled in as well.
If all I've done is open the form, change nothing and attempt to move to design mode, I get that error. So I've put some Debug.Print text in both the OnCurrent and BeforeUpdate events identifying the event and the status of the Dirty parameter.
If I move the record in the active form to the next record, I get the following info in the Immediate window:
From OnCurrent Dirty = False
From BeforeUpdate Dirty = True
From OnCurrent Dirty = False
If I don't move to another record after first opening the form and attempt to move to design mode, I get the following in the Immediate window:
From BeforeUpdate Dirty = True
Additionally, when this happens, the Debug.Print line is executed in the BeforeUpdate event (it's the first line of code in the event). The Debug.Print contains the Me.Dirty parameter. Yet the very next line of code which contains the Me.[control] If statement is where the cursor stops when I ask to Debug the error.
I'm confused as to why in the first circumstance the OnCurrent reports False for Dirty while the BeforeUpdate reports True.
Again, this only affects me when designing. It's not an issue for the user.
Any thoughts?
Thanks,
Vic