[AccessD] Locking a textbox based on other form controls

Christopher Jeris cjeris at fas.harvard.edu
Wed Aug 16 14:52:13 CDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is probably fairly simple but I haven't gotten far with the help and
Google.

Access XP.  I have an unbound form containing several textboxes and some
action buttons.  Based on which action button the user presses, I want some
of the textboxes to become non-writable and others to remain writable.

When a record is loaded into the form, the textboxes are initialized using
statements of the form

acForm![faaCustomerID].Value = "1264"

and each such textbox has its Locked property set to False.

Later, in a function called from one of the command buttons' _Click()
handlers, I attempt to do

acForm![faaCustomerID].Locked = True

and receive

Run-time error 2166: You can't lock a control that has unsaved changes.

Now from the help for the properties TextBox.Text, TextBox.Value, it seems
that "unsaved changes" means that .Text <> .Value .  That isn't true here,
as far as I can tell, since nothing has acted to edit the control since I
set its .Value property.

What don't I understand here?  How can I convince Access to let me lock
these controls?

thanks, Chris Jeris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFE43dt5ICCNV0oGWARAtDmAJ9FkL34t0JSslMk543a38eEPTsTFACglP/r
4LGdbgGO8au1fZJ00xUu6uY=
=2t6Q
-----END PGP SIGNATURE-----



More information about the AccessD mailing list