Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513

    moving a cntrol to a different shhet on a tab control causes "issues"

    i have a checkbox on sheet1 of a tab control (with associated code...); it belongs on sheet3
    when i cut (from sheet1), and paste it (to sheet3), related code events fail. (!?)


    since it's refered to as me.checkbox (vs. me.sheet1.checkbox1), i would think this is not an issue; but apparently, it is...

    thoughts?

    many thanks in advance,
    mark

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    As far as I know, all controls on all of the tabs of a TabControl must be unique.

  3. #3
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513
    agreed.
    which is why I thought moving it would not cause a problem; if i was recreating it... (or does the very act of cut and paste cause a confusion of their being a second control of the same name).

    is there an easier way of moving controls arcoss sheets? the thought of having to create a new control of a different name and update all that code... AURH ! maybe a simple delete and recreate would be better (?)

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Cut and Paste and then click the "..." button on the new tab and it should resync the code. I'm not used to using a .sheet reference.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I just tested cut/paste of a checkbox. The [Event Procedure] setting in the event property did not replicate. I just had to reset that in the event.

    There is no .Sheet reference for controls on Tab pages. Just reference the controls as if they are directly on the form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513
    AURHHH ! I wasn't resyncing the code (i ought to know about that!)

    when all esel fails, check the obvious !

    thanks
    mark

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad you got this fixed, but for others who may arrive here while searching on the subject, especially those who may have moved Controls (as when addressing a 'real-estate' problem by moving many Controls to one or more Tabbed Pages) and want a way to do this all at once, here's a hack.

    Courtesy of ADezii at Bytes.com, this code will "reconnect" Controls to some selected Events (OnClick and AfterUpdate in this example.) It can be modified for other Events, and has the advantage of updating a large number of Controls without doing them one by one.
    Code:
    Private Sub Form_Load()
    Dim ctl As Control
    
    For Each ctl In Me.Controls
    For Each ctl In Me.Controls
    If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Or (TypeOf ctl Is CommandButton) Then
    If ctl.OnClick = "" Then
    ctl.OnClick = "[Event Procedure]"
    End If
    End If
    Next
    For Each ctl In Me.Controls
     If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Then
       If ctl.AfterUpdate = "" Then
         ctl.AfterUpdate = "[Event Procedure]"
       End If
     End If
    Next
    End Sub


    Linq ;0)>

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

Similar Threads

  1. Replies: 13
    Last Post: 09-14-2014, 05:48 PM
  2. Replies: 5
    Last Post: 06-25-2012, 02:06 PM
  3. Replies: 13
    Last Post: 01-11-2012, 09:44 PM
  4. File Export "sort" issues
    By jgelpi16 in forum Programming
    Replies: 24
    Last Post: 09-15-2010, 12:14 PM
  5. Replies: 1
    Last Post: 10-19-2009, 02:37 AM

Tags for this Thread

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