• Double click to select another record (2000 SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Double click to select another record (2000 SR1)

    Author
    Topic
    #416337

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #931118

      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

      • #931162

        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. cheers

    Viewing 0 reply threads
    Reply To: Double click to select another record (2000 SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: