Access 2007: How do I have a Searching List box update a form to go to a corresponding record?

回答済み Access 2007: How do I have a Searching List box update a form to go to a corresponding record?

  • 2012年4月12日 16:39
     
     

    I created a searching List Box according to these directions:

    http://msdn.microsoft.com/en-us/library/dd644811%28v=office.12%29.aspx

    however, it does not provide me with direction on how to make the selection in the text box "go to" a corresponding record (in a form).

    I want to have all records available but use the selection in the searching list box to go to a particular record.

    The searching list box is in the form (CaseInfo_frm) along with all the record information.

    -I want to search by Case Number field name is "CaseNumber"

    -On the searching list box--the text box name is "txtCase" I want to be able to enter a case number hit enter and have the record display.

    -The list box "1stCae" updates "txtCase" and displays matching cases as I type in the txtCase textbox.

    Please help!

すべての返信

  • 2012年4月12日 17:02
     
     回答済み コードあり
    list box have ItemsSelcted property.
        Dim frm As Form, ctl As control
        Dim varItm As Variant
        If FilesList.ItemsSelected.Count = 0 Then
            MsgBox "no records selected", vbInformation
            Exit Sub
        End If
        Set frm = Forms!YourForm
        Set ctl = frm!FilesList
        For Each varItm In ctl.ItemsSelected
          'your code
        Next varItm
    

  • 2012年4月12日 17:10
     
     
    would this be inserted as an "on Enter" event procedure for the txtCase field?
  • 2012年4月12日 17:31
     
     

    It can be on enter event or place a button.