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

CheckBox Question.

P: 1

I am new to Access and have just put together a Database using the Wizard.
I have a tab which stores infomation however I would like to add a check box to it, (which I did by using the VB tools) however I would like the tab to be disabled until that check box is checked by the user?

Can anyone advise how this can be done. I would like to tab to be greyed out until the check box is check, help?

Code please?

Mar 10 '07 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 159
I'm not sure after reading your post if the check box in question is on the tab or else where on the form.
regardless of In the check box's location you will need to enter the code in the check box's after update event.

If the check box is on the main form (not on the tab) then set the tab's enabled property to false in the properties window and in the checkbox's afterupdate event enter

Expand|Select|Wrap|Line Numbers
  1. private sub check0_afterupdate()
  3. if me.check0 = true then
  4. me.tabctl.enabled = true
  5. elese
  6. me.tabctl = false
  7. end if
  9. end sub 
Of course you will need to change the name of all controls to match the ones on your form.

If you want the check box to actually be located on the tab it inables/disables then you can do two things. You can disable all of the controls on the tab rather than the tab itself, or you can place the check on the main form and drag it on top of the tab. It will appear to be on all pages of the tab but not be disabled when the tab is.
With the later option the code will be the same as above. With the former the structure of the If statement will be the same but the code will have to enable/disable all of the controls rather than the tab.
Mar 10 '07 #2

Expert 2.5K+
P: 3,532
If you place the checkbox on the main form itself, you won't have to "drag it on top of the tab!" It'll automatically appear on each and every tab!
Mar 11 '07 #3

Expert Mod 15k+
P: 31,470
If the CheckBox is unbound, you will need code similar to MSeda's (Simplified version supplied).
Expand|Select|Wrap|Line Numbers
  1. Private Sub Check0_AfterUpdate()
  2.     Me.[TabCtl].Enabled = Me.Check0
  3. End Sub
If the CheckBox is bound to a field from your recordset, then let us know and we can explain the slightly more complicated approach that will handle that.
Mar 11 '07 #4

Post your reply

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