T
Tassos Pavlakos
It seems that Access XP is seriously flawed when it comes to accessing
Me.Recordset inside an ADP.
This has been mentioned before in this newsgroup in relation to checkboxes
but it seems that this is a more general problem.
Here are my findings:
When you access the current form's recordset in any way (for example
checking Me.Recordset("ID").Properties("KEYCOLUMN") in the OnLoad event
handler), Access XP enters some buggy mode with the following symptoms:
1) If there is a checkbox bound to a bit field, clicking on the checkbox
makes Access crash
2) Trying to programmatically change the value of *any* field of the form
(say Me.txtName="Tassos") also makes Access crash.
The above generally happen only if they immediately follow accessing
Me.Recordset.
If, on the other hand, after accessing Me.Recordset, you fiddle with, say,
some combobox, or change the value of some other (non-checkbox)
field via the UI and *then* do anything of the above, Access has magically
exited its buggy mode and everything works fine.
Until you move to the next record that is! Access XP seems to remember that
access to the recordset (regardless of where and when you did
it!), and enters the buggy mode again everytime you move to another record!
Solutions (for situations where you can't escape accessing Me.Recordset)
=======
It seems that *setting* the value of a field of the recordset makes Access
XP exit its buggy mode. Considering all the above, right after
having finished accessing Me.RecordSet and/or in the OnCurrent event handler
set the value of a field of the recordset
(Me.Recordset("Name")="blabla") and all is fine. I usually have a field
ModifiedAt in my records, to keep track of when was the last time the
record was modified, and I set that to the current datetime.
Hope this saves some hours to someone!
Comments are welcome!
[Windows 200 SP4, Access XP SP3, MDAC 2.8 SP1]
Me.Recordset inside an ADP.
This has been mentioned before in this newsgroup in relation to checkboxes
but it seems that this is a more general problem.
Here are my findings:
When you access the current form's recordset in any way (for example
checking Me.Recordset("ID").Properties("KEYCOLUMN") in the OnLoad event
handler), Access XP enters some buggy mode with the following symptoms:
1) If there is a checkbox bound to a bit field, clicking on the checkbox
makes Access crash
2) Trying to programmatically change the value of *any* field of the form
(say Me.txtName="Tassos") also makes Access crash.
The above generally happen only if they immediately follow accessing
Me.Recordset.
If, on the other hand, after accessing Me.Recordset, you fiddle with, say,
some combobox, or change the value of some other (non-checkbox)
field via the UI and *then* do anything of the above, Access has magically
exited its buggy mode and everything works fine.
Until you move to the next record that is! Access XP seems to remember that
access to the recordset (regardless of where and when you did
it!), and enters the buggy mode again everytime you move to another record!
Solutions (for situations where you can't escape accessing Me.Recordset)
=======
It seems that *setting* the value of a field of the recordset makes Access
XP exit its buggy mode. Considering all the above, right after
having finished accessing Me.RecordSet and/or in the OnCurrent event handler
set the value of a field of the recordset
(Me.Recordset("Name")="blabla") and all is fine. I usually have a field
ModifiedAt in my records, to keep track of when was the last time the
record was modified, and I set that to the current datetime.
Hope this saves some hours to someone!
Comments are welcome!
[Windows 200 SP4, Access XP SP3, MDAC 2.8 SP1]