Results 1 to 2 of 2

Thread: Selecting tables from a list (HELP)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    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.

  2. #2
    Junior Member
    Join Date
    Mar 2006
    Posts
    16

    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
  •  



Click Here to Expand Forum to Full Width