Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Bishop
Starting Member
5 Posts |
Posted - 2004-12-14 : 14:41:09
|
I want to be able to use a check box in a form that changes the enable/disable property of a record based on the Boolean status. Does anyone have a handy piece of code for this?Thanks,Bish |
|
PETE314
Starting Member
37 Posts |
Posted - 2004-12-29 : 11:51:48
|
Why not just do conditional formating on the form for each of the objects you wish to be disabled?Select and use the expression blnCheckBox = -1 (where blnCheckBox is the name of the object you are clicking on and off......and -1 is the value in a SQL bit type for the true value of a Checkbox. |
 |
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2004-12-30 : 14:43:51
|
Bishop, in the onChange or onClick event of the checkbox you can put in module code to change the enabled/disabled properties of anything in the form. It would look something like this:If chkDisableFormCheckBox.Value = True Then Me.enabled = FalseElse Me.enabled = TrueEnd If---------------------------------------------------------------------------------Infoneering: Information Technology solutions engineered to professional standards. |
 |
|
jhermiz
3564 Posts |
Posted - 2004-12-30 : 15:28:17
|
Bishop,If you are talking about the contents of the record you must use the AllowEdits property...If Me.chkBoxYourBool.Value = True thenForms!frmYourForm.AllowEdits=FalseelseForms!frmYourForm.AllowEdits = Trueend ifJonA new beat on the web -- http://www.web-impulse.com |
 |
|
Bishop
Starting Member
5 Posts |
Posted - 2005-01-07 : 16:53:26
|
I had 4 fields that I wanted to be disabled unless the user checked the box to enable them. Here is how I made it happen, and it seems to suit my purpose. Thank you all for your help.BishopIf (Me!chkMacroUpdt = True) Then Me!TxtMacro.Enabled = False Me!txtMacrodate.Enabled = False Me!txtMacroRev.Enabled = FalseElse Me!TxtMacro.Enabled = True Me!txtMacrodate.Enabled = True Me!txtMacroRev.Enabled = TrueEnd If |
 |
|
|
|
|