Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jul 2004
    Location
    Columbia, Maryland, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Find Record in Subform (XP)

    Hello,
    I have a Tab Form and want to find a record in Tab 1 based on a record number of Tab 0, my message box says found but it does not go to the record it self. I don't know what am doing wrong, but here is my code, can anyone see what am doing wrong?
    Luis
    Private Sub TabControl_Change()
    On Error GoTo TabControl_err
    Dim rs As DAO.Recordset, message As String, provID As Variant, sFilter As Variant
    Dim db As Database
    Set db = CurrentDb()
    provID = Me.PROVIDER_ID
    Set rs = Me.RecordsetClone
    Select Case TabControl.Value
    Case 0

    Case 1
    Set rs = db.OpenRecordset("Contacts_Provider_Tbl", dbOpenDynaset)
    sFilter = "[PROVIDER_ID] = '" & Me.PROVIDER_ID & "'"
    Me.Provider_Subfrm.Form!PROVIDER_ID.SetFocus
    rs.FindFirst sFilter
    If rs.NoMatch = True Then
    MsgBox "No matches found"
    Else
    MsgBox "Found"
    Me.Bookmark = rs.Bookmark
    End If
    rs.Close
    Set rs = Nothing
    TabControl_exit:
    Exit Sub
    TabControl_err:
    MsgBox Err.Description
    Resume TabControl_exit
    End Sub

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

    Re: Find Record in Subform (XP)

    In the line

    Me.Bookmark = rs.Bookmark

    "Me" refers to the main form, not the subform. Change it to

    Me.Provider_Subfrm.Form.Bookmark = rs.Bookmark

Posting Permissions

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