|
-
Mar 30th, 2006, 06:10 AM
#1
Thread Starter
Junior Member
Selecting tables from a list (HELP)
I am using Access 2000, VB 6.0, connection method ADO Data Control, OLEDB
I've written an application which splits a large table in a database to lots of mini-tables. Upon execution these table names begin to appear in a simple list box which I added.
I'm totally confused as to how to implement the next stage....
Basically, I want to be able to highlight one of the tables on the simple list box....then click a command button which will open up a new form with either a datagrid/msflexgrid or whatever containing the relevant records from the selected table from the previous list.
I know how to set the recordsource manually...i.e. in my new form when I connect the data control to the grid and and choose the database I am given the list of tables at the development stage...but I want to be able to select the tables at run-time instead. (from my list)
Many Thanks in advance.
-
Mar 30th, 2006, 08:51 AM
#2
Junior Member
Re: Selecting tables from a list (HELP)
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\sale\sale.mdb;Persist Security Info=False"
cn.CursorLocation = adUseClient
Set rs = cn.Execute("select * from " & Combo1.Text)
Set DataGrid1.DataSource = rs
End Sub
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
|