Unable to LockBoundControls based on bound combobox value

B

burchark

Hi!

I want to lock the fields on a form and subform based on the status field in
my main table. The status may be open or closed. Using a combo box (named
status and with controlsource = status), I want to select either "Open" or
"Closed" and use the AfterUpdate event to run the code for LockBoundControls
(from http://allenbrowne.com/ser-56.html).

By the way, the code works beautifully if I just use a button on the form as
suggested by the original coding for 'LockBoundControls'. But when I want to
run it from status_AfterUpdate, it produces errors at the point of setting
the form's dirty property to false:

If frm.dirty then
frm.dirty = false
end if

Has anyone out there been able to run LockBoundControls based on the value
selected in a bound ComboBox? If so, how? Any assistance is greatly
appreciated.
 
B

burchark

Ah! I finally discovered that the error was being caused by another event:
the form's AfterUpdate event.

I was attempting to set values of
LastModifiedDateTime and LastModifiedBy
using the Form_AfterUpdate event.

Once I commented this out, the unlocking procedure worked fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top