Sure, bounce away ;-)
Well, yes, a Requery will run the Current event (on the
first record), but, unless the first record was already the
current record, Requery will make the first record current
and the locked procedure should be executed. I don't think
it's worth worrying about, but if it is an unacceptble
performance hit, you could check to see if one of the
controls is already locked and skip the loop.
As for the Tag property, I would rather use InStr than hard
code control names.
For Each ctl In Me
If InStr(ctl.Tag, "LOCK") > 0 Then ctl.Locked = True
Next ctl
Another technique that I have used occasionally is to add a
prefix to the control names (e.g. LOCKcboProduct) so the
loop would look like:
For Each ctl In Me
If Left(ctl.Name, 4) = "LOCK" Then ctl.Locked = True
Next ctl
--
Marsh
MVP [MS Access]
If you don't mind can I bounce a couple of questions off you?
1) If you use the form's Current event to check if record has been submitted
... aren't you possibly checking it more than needed .. for ex if they are
using requery in the form ... the OnCurrent would trigger each time for the
same record, correct?
2) The loop with the Tag property is a great idea, however I use the Tag for
other things in my code & you can't use it for multiple things, right? Or
maybe you could using the Instr / Mid functions ... but I would think that
could get very confusing?
"Marshall Barton" wrote need
to in
the that
a