Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Nov 2004
    Location
    London, Gtr London, England
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Controlling Data Entry (Access 2003)

    Hi,

    Depending on the answer to a "question 1", I want to restrict the checkboxes that a user can select in "question 2". Is this possible?

    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Controlling Data Entry (Access 2003)

    You can put code in the After Update event of the control (text box? combo box? check box?) for Question 1 to enable/disable check boxes for Question 2. Here is an entirely fictitious example:

    Private Sub txtQuestion_AfterUpdate()
    Select Case Me.txtQuestion
    Case 1
    Me.chkChoice1.Enabled = True
    Me.chkChoice2.Enabled = True
    Me.chkChoice3.Enabled = False
    Case 2
    Me.chkChoice1.Enabled = True
    Me.chkChoice2.Enabled = False
    Me.chkChoice3.Enabled = True
    Case 3
    Me.chkChoice1.Enabled = False
    Me.chkChoice2.Enabled = True
    Me.chkChoice3.Enabled = True
    End Select
    End Sub

    You must, of course, adapt this for your situation.

  3. #3
    New Lounger
    Join Date
    Nov 2004
    Location
    London, Gtr London, England
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Controlling Data Entry (Access 2003)

    Hans, Thanks for your advice.

    I have tried various times to adapt Hans suggestions to my situation but have had no success making it work. I have attached my latest attempt , have I made an obvious mistake?
    If anyone has any suggestions, I would really grateful for any advice to be really simple as this is the first time I have tried to use Visual Basic and my knowledge of this type of thing is pretty much non existent <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    Thanks!
    Attached Files Attached Files

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Controlling Data Entry (Access 2003)

    Can you tell us what the Row Source of cboTCR4 is?
    If you wish, you can post a stripped down copy of your database. See <post#=401925>post 401925</post#> for instructions.

  5. #5
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Anderson, Indiana, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Controlling Data Entry (Access 2003)

    In your code the names do not match the controls on your form.

    Example
    Private Sub cboTCR4_AfterUpdate() Should BE
    Private Sub TCR4_AfterUpdate()

    Me.chkTCR_5a.Enabled = True should be
    Me.TCR_5a.Enabled = True

    Try changing these and see if that helps out.

  6. #6
    New Lounger
    Join Date
    Nov 2004
    Location
    London, Gtr London, England
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Controlling Data Entry (Access 2003)

    Thanks Winston - I'll give that a try.

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Controlling Data Entry (Access 2003)

    Do what the previous lounger said, but in addition to that, always ensure that the following line of code is always placed as the 2nd line of code in any code module.

    Option Explicit

    This ensures when you compile code it throws up any undefined variables you may be trying to use.

  8. #8
    New Lounger
    Join Date
    Nov 2004
    Location
    London, Gtr London, England
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Controlling Data Entry (Access 2003)

    Thanks Pat and Winston - the combination of your two tips has worked, you have made my Monday morning!

  9. #9
    New Lounger
    Join Date
    Nov 2004
    Location
    London, Gtr London, England
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Controlling Data Entry (Access 2003)

    row source: 0;1;2;3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •