Ahh I should have looked at the handy little icon that says what version you're using lol.
I can't convert back any further than 2000 because I only have 2007/10 on hand.
If some nice person on the forum see's this that has 2003 or 2000 they could convert it for you.
Other than that, heres the changes I made, maybe this can get you started.
Change the Rowsource of your combo box to "SELECT DISTINCT FruitType FROM [Fruit Stand]"
And change the RowsourceType to Table/Query
In the forms open event but the following code:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim RS As DAO.Recordset
Dim f As Field
Dim strListSource As String
'Opens the Table as a recordset
Set RS = CurrentDb.OpenRecordset("Fruit Stand")
'Buils the string of the row source
For Each f In RS.Fields
strListSource = strListSource & ";" & f.Name
Next
'removes leading semicolon
strListSource = Mid(strListSource, 2)
'Sets rowsource to listbox
List2.RowSource = strListSource
'Updates listbox
List2.Requery
Set RS = Nothing
End Sub
And in the command buttons On click event put
Code:
Private Sub Command5_Click()
Dim strWHERE, strSelect, SQL As String
Dim choice As Variant
'Checks to make sure at least one column is chosen
If List2.ItemsSelected.Count = 0 Then
MsgBox ("You must select at least one field to view")
Exit Sub
End If
'Loop through Listbox items and build select part of SQL string
For Each choice In List2.ItemsSelected
strSelect = strSelect & ", [" & List2.ItemData(choice) & "]"
Next choice
'removes leading comma and space
strSelect = Mid(strSelect, 3)
'Builds full query definition
If Combo0.Value & "" = "" Then 'No fruit type was selected, so we want to show all fruits, therefore no where clause
strWHERE = ""
Else
strWHERE = "WHERE [FruitType]='" & Combo0.Value & "'"
End If
SQL = "SELECT " & strSelect & " FROM [Fruit Stand] " & strWHERE
'Sets the definition of the query
CurrentDb.QueryDefs("Query1").SQL = SQL
'Opens the query and closes the form
DoCmd.OpenQuery "Query1"
DoCmd.Close acForm, "Form1", acSaveYes
Eeeek, I wish you could see it in action haha GL
End Sub