Results 1 to 7 of 7
  1. #1
    accessnewbie is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Oct 2009
    Posts
    20

    Working with objects on tab controls

    Hi all. I have one form. On the form I have 7 tabs. Each of them has 2 check boxes. I need to run some code so that when the form is loaded, the check boxes are marked to False. I can do this with the check boxes on the form, but not those on the tabs. Here is the code I'm using - keep in mind the check boxes on the tabs are named "chk1...", "chk2..." from 1-7:

    For Each ctl In Me.Controls
    If ctl.Name Like "chk*" Then
    If Mid(ctl.Name, 4, 1) >= 1 And Mid(ctl.Name, 4, 1) <= 7 Then


    Select Case Mid(ctl.Name, 4, 1)
    Case 1
    Me.pag1.Controls(ctl.Name).Value = False 'this is not working
    End Select
    Else
    Me.Controls(ctl.Name).Value = False 'but this works just fine
    End If
    End If
    Next ctl

    Any ideas? Thanks a lot!
    MW

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    Disregard the tabs for purposes of referring to the check boxes.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    accessnewbie is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Oct 2009
    Posts
    20
    Using the same logic as I do for the other check boxes ("Me.Controls(ctl.Name).Value = False") gives me the following error: 2448 - You can't assign a value to this object. Or am I misunderstanding your suggestion?

    Thanks,
    MW

  4. #4
    accessnewbie is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Oct 2009
    Posts
    20
    I think I found the problem. Tell me if this makes sense. The two check boxes are set up as an option group. They can only select one or the other. I deleted the check boxes and added a single check box on the first tab control and it was able to set itself to false. This stinks.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    Ah, for an option group you set the value of the frame, not the actual checkboxes. For a frame, you'd have a numerical value, typically 1 or 2 for 2 options.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    accessnewbie is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Oct 2009
    Posts
    20
    Sorry I neglected that detail; I didn't realize it was so critical. Thank you so much for the help! It works perfectly now. I just hope I don't get a bruise from banging my head against a brick wall for so long.

    Many thanks,
    MW

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,529
    Happy to help! I know from experience those brick walls don't have a lot of give.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Assigning controls not working
    By SemiAuto40 in forum Programming
    Replies: 5
    Last Post: 10-20-2011, 06:53 PM
  2. Objects on the form
    By injanib in forum Forms
    Replies: 2
    Last Post: 03-19-2011, 01:48 AM
  3. Acc97 and OLE objects
    By bnnook in forum Programming
    Replies: 2
    Last Post: 03-17-2011, 01:03 PM
  4. Referring to objects
    By stubbly in forum Programming
    Replies: 1
    Last Post: 10-14-2009, 09:36 AM
  5. Replies: 1
    Last Post: 09-28-2009, 05:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums