Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557

    Unanswered: Listbox Selection Generate Query

    I have a list box that generates a query... below is the code and the picture.

    Code:
    Private Sub cmdFindParts_Click()
        Dim SeriesID As Integer
        SeriesID = lst3.Value
        If SeriesID = 1 Then
            With lstParts
                .ColumnCount = 3
                .ColumnHeads = True
                .RowSourceType = "Table/Query"
                .RowSource = "SELECT Parts.PartID, Parts.Description, Parts.Series WHERE Part.Series = [Forms]![Form1]![lst3] FROM Parts"
            End With
        End If
    End Sub
    Thanks for the help... I cant get it to only show the ones for that series.

    JS
    Attached Thumbnails Attached Thumbnails form1.jpg  
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  2. #2
    Join Date
    Nov 2003
    Posts
    267
    .RowSource = "SELECT Parts.PartID, Parts.Description, Parts.Series WHERE Part.Series = " & [Forms]![Form1]![lst3] & " FROM Parts"

    But I would use
    .RowSource = "SELECT Parts.PartID, Parts.Description, Parts.Series WHERE Part.Series = " & SeriesID & " FROM Parts"

    Don't forget to requry your lstParts

    S-

  3. #3
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557

    ReQuery?

    What do you mean requery? (press the button again?) I think I have seen an example of a requery, but I didnt know what it was for so I didnt pay much attention.

    Thanks for the help .

    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

Posting Permissions

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