Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    173

    Unanswered: This Code Worked Until Tab Control Added

    I used the code below to determine a selection of records in a sub-form.

    It works perfectly - Until I added a tab Control to the form with the sub-form on the first page - now the code does not work.

    Does anyone know what needs to be changed to refer to this sub-form now that it is on a Tab control?

    here is the link to the site where I originally got the code.


    http://216.92.17.166/board2/viewtopi...7ac9d333d23b0f

    Thanks- AB


    'form declarations
    Private mlngSelTop As Long
    Private mlngSelheight As Long

    Private Sub cmdSubFormSelected_Click()
    Dim strX As String
    Dim intI As Integer

    ' substitute my_subform with your subform name
    With Me.my_subform.Form.RecordsetClone
    .MoveFirst
    .Move mlngSelTop - 1
    intI = 1
    Do Until intI > mlngSelheight
    'building string of selected records
    'substitute control_name with your field name
    strX = strX & intI & ": " & !control_name & vbNewLine
    .MoveNext
    intI = intI + 1
    Loop
    End With
    'Me.my_subform.Form.SelTop = mlngSelTop
    'Me.my_subform.Form.SelHeight = mlngSelheight
    MsgBox strX

    End Sub

    Private Sub my_subform_Exit(Cancel As Integer)
    mlngSelTop = Me.my_subform.Form.SelTop
    mlngSelheight = Me.my_subform.Form.SelHeight
    End Sub

  2. #2
    Join Date
    Aug 2004
    Posts
    173

    I Found the Problem!

    I found the problem - when I pasted the sub-form on the Tab Control, there was an onExit Event procedure on the sub-form that needed to be reset - works fine now! whew!!

    AB

Posting Permissions

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