Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2006

    Unanswered: Retrieving record from listbox

    Hello all -

    I have a listbox that lists the records entered above in several textboxes on the form. If I double click on a particular record in the listbox, it sends the fields to my text boxes, but I really am just getting the row info and and NOT the record I want, because after updating I now get TWO records with original and edited text.

    Has anyone had to do this before? I have been experimenting with Listcount and looping through the recordset, but I can't seem to find a way.

    Here's my code:

    Dim db As Database
    Dim rs As Recordset

    Set db = CurrentDb
    Set rs = db.OpenRecordset("tblCaseNotes", dbOpenDynaset)

    With rs
    .FindFirst ("[CaseNotesID] = " & "'" & Me.CaseNotesID.Value & "'")
    If Not .NoMatch Then

    !CaseNoteDate = Me.CaseNoteDate.Value
    !CaseNoteSubject = Me.CaseNoteSubject
    !CaseNoteText = Me.CaseNoteText
    MsgBox "Record not found"
    End If
    End With

    Me.CaseNoteDate.Value = Me.lstCaseNotes.Column(2)
    Me.CaseNoteSubject.Value = Me.lstCaseNotes.Column(3)
    Me.CaseNoteText.Value = Me.lstCaseNotes.Column(4)


    Anybody?? Thanks

    Last edited by mike21152; 11-04-09 at 11:22. Reason: add code

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    Link the recordset of your form (or of a subform into your form) to the table tblCasenotes and use the technique described here: Forms: Have the form move to the record selected in List/Combo box
    Have a nice day!

Posting Permissions

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