Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Double click to select another record (2000 SR1)

    I have a members form which has a field XRefID (Cross Reference ID) which is used to record the Membership ID (ID_M) number of a spouse or partner. I want the user to be able to double click on this field and have it navigate to the spouse's membership record. I tried using Docmd.FindRecord with the following syntax: DoCmd.FindRecord ID_M = Me!XRefID which isn't working. I'd appreciate being pointed in the right direction.

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

    Re: Double click to select another record (2000 SR1)

    Try this:

    Make sure that you have a reference to the Microsoft DAO 3.6 Object Library (in Tools | References... in the Visual Basic Editor). Make the On Dbl Click event procedure look like this:

    Private Sub XRefID_DblClick(Cancel As Integer)
    Dim rst As DAO.Recordset
    Dim strSearch As String

    On Error GoTo Err_Sub

    If Me.XRefID.Text = "" Then Exit Sub

    strSearch = "ID_M = " & Me.XRefID.Text
    Set rst = Me.RecordsetClone
    rst.FindFirst strSearch
    If rst.NoMatch Then
    Beep
    Else
    If Me.Dirty Then RunCommand acCmdSaveRecord
    Me.Bookmark = rst.Bookmark
    End If

    Exit_Sub:
    Set rst = Nothing
    Exit Sub

    Err_Sub:
    MsgBox Err.Description, vbExclamation
    Resume Exit_Sub
    End Sub

  3. #3
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Double click to select another record (2000 SR1)

    As always, worked like a charm. I had to Me.XRefID.Text to Me.XRefID.Value since it is an integer but otherwise no problems.

    Thanks for saving me hours on this one. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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