By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

Setting textbox to accept data after a check box has been checked

P: 112
I am Newbie using Access 2003. I am trying to have one list box and one textbox on my form grayed out (not useable) until a check box has been checked. Is there a simple way of doing this?
Oct 11 '07 #1
Share this Question
Share on Google+
6 Replies

Expert Mod 10K+
P: 12,366
You'll have to use the VBA editor and the After Update event. Whether or not that's difficult for you I wouldn't know. Let us know if you understand any of that.
Oct 11 '07 #2

P: 112
I know how to insert code into the VBA editor, however I do not posses the skills to write the code on my own (would love to learn, never the time). If someone has existing code that will do this and I can copy it into the right spot changing the names of the appropriate boxes and forms to match. If there is no code then I guess I am out of luck. I was hoping there was just a property setting that would do it, but things are never as easy as they appear.
Oct 12 '07 #3

Expert 2.5K+
P: 3,532
I think this will do what you need. You have to set the Enabled Properties for YourTextBox and YourListBox to No in their property boxes, then use this code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If Not Me.NewRecord Then
  3.  If YourCheckBox Then
  4.    YourListBox.Enabled = True
  5.    YourTextBox.Enabled = True
  6.  Else
  7.    YourListBox.Enabled = False
  8.    YourTextBox.Enabled = False
  9.  End If
  10. Else
  11.  YourListBox.Enabled = False
  12.  YourTextBox.Enabled = False
  13. End If
  14. End Sub

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourCheckBox_Click()
  2. If YourCheckBox Then
  3.   YourListBox.Enabled = True
  4.   YourTextBox.Enabled = True
  5. Else
  6.   YourListBox.Enabled = False
  7.   YourTextBox.Enabled = False
  8. End If
  9. End Sub
Welcome to TheScripts!

Linq ;0)>
Oct 12 '07 #4

P: 112
Hi Missinglinq

Thanks for the code, but it is not working as intended yet. When I set my checkbox Enable property to NO all my records even ones that are already checked are disabled. Then when I check any record that is not checked, it enables the textbox and listbox in all my records. When I uncheck it, it disables the textbox and listbox in all my records. Is there something that the code needs to make it to target only the record it is currently on? Any help would be great!

Oct 12 '07 #5

P: 112
I final got it working... some of my code on Current was screwing it up.

Oct 15 '07 #6

Expert 2.5K+
P: 3,532
Glad you got it working!

Linq ;0)>
Oct 16 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.