Open query from code

Access Virgin

Registered User.
Local time
Today, 15:56
Joined
Apr 8, 2003
Messages
77
I have a multi select list box that contains field names in table, ie tblStaff.SurnameName. I want to pick certain fields from this list box to then open a query with the results.

I have managed to create the select statement, eg SELECT tblStaff.SurnameName,tblStaff.Company,tblStaff.TelNo FROM tblStaff; but im not sure how to display the results of this SQl string

I want to click a button to open the query
 
>>>

Code:
Private Sub filt_Click()
Dim f
f = ""
For Each i In Me.yourListBox.ItemsSelected
f = f & "," & Me.yourListBox.Column(0, i)
Next
f = Right(f, Len(f) - 1)
strsql = "select * from email where ID_EMAIL in (" & f & ")"
MsgBox strsql
End Sub
 
What is that doing? why is the email reference in it?
 
hello,

the email is just an example

here you can take a look how does its work.
 

Attachments

Users who are viewing this thread

Back
Top Bottom