Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox with Access DB

Status
Not open for further replies.

LonC25

IS-IT--Management
Nov 19, 2002
62
US
I have a listbox that diplays the tables of an Access DB. I need to be able to click on a item in the listbox and display the contents of that table into a DBGrid.

I have the listbox populated with the table names, but I can't get the click funtion to populate the DBGrid with the selected table data.
 
On the combo's click event:

Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = wrkJet.OpenDatabase("C:\myData\myDb.Mdb", False, False)

Set rs = db.OpenRecordset("SELECT * FROM " & Combo1.Text, dbOpenSnapshot)

Set Data1.Recordset = rs

Data1 is the DAO data control which the DBGrid is bound to.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top