William Hindman
wdhindman at dejpolsystems.com
Wed Aug 16 17:13:50 CDT 2006
...a textbox has two properties that can be confusing ..."text" is the data currently in the control while "value" is the data last saved for the control ...in an unbound form you have to save the text data for it to become the value data ...you might try saving the data before locking the text box ...hth. William ----- Original Message ----- From: "Christopher Jeris" <cjeris at fas.harvard.edu> To: <accessd at databaseadvisors.com> Sent: Wednesday, August 16, 2006 3:52 PM Subject: [AccessD] Locking a textbox based on other form controls > -----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----- > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >