|
-
August 2nd, 2011, 07:11 AM
#1
How to retrieve data from access table according to listbox contains
How to retrieve data from access table according to listbox contains
I have a Data Base Project in Visual Basic 6.0
I have a access table named Table1 and a ListBox named List1 and a ComboBox named Combo1.
There are multiple List in the ListBox and ComboBox both.
Now I pass two list item from another code [Code] to ListBox now there are "Mr" and "Dr" in ListBox and I select "Title" in the ComboBox
Now How how can I retrieve data from Table 1 (Title Field)
The following code did not work.
Sub List()
'Database connection already Defined
For LI = 0 To List1.ListCount - 1
RecordSet.Open ("select * from Table1 where " & Combo1.Text & _
" like '" & List1.List(LI) & "%'"), Connection, adOpenDynamic, adLockOptimistic
Next LI
End Sub
Further Clarification
ListBox Contains
Mr
Dr
Data in Table1
Mr. SKB
Dr. GRB
Mr. LNK
Ms. RPK
Result (anywhere like flexgrid, textbox etc)
Dr. GRB
Mr. SKB
Mr. LNK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|