How to import ODBC Database tabel into Access ???

How to import ODBC Database tabel into Access ???

Post by HiJac » Fri, 08 Jan 1999 04:00:00



How can I import an ODBC table into Access.  I know how to link tables,
but I need to know how to import a table directly.  I need to do it
without any SQL statement, SLECT INTO.  The code below works fine for
linking the table, but how can I modify to import the table????

Public Sub LinkODBCTable()
    Dim DB As Database
    Dim tdfODBCTable As TableDef

    ' Open a Microsoft Jet database.
    Set DB = OpenDatabase _
        ("C:\MDBDirectoty.mdb")

    ' Create a TableDef object.
    Set tdfODBCTable = DB.CreateTableDef _
        ("TableDefName")

    ' Set the connection information.
    tdfODBCTable.Connect = _
        "ODBC;DATABASE=;UID=;PWD=;DSN="
    tdfODBCTable.SourceTableName = "ODBC_TABLE_NAME"

    ' Append the TableDef object to create the link.
    DB.TableDefs.Append tdfODBCTable

End Sub

Thanks for any help
-John-

 
 
 

1. Heeeeelp...I need to import data from Excel to a tabel in Access

Hi
I am designing a program in VB6 and now I have a little problem. I want to
import data from Excel97 to a tabel in Access 97.

In my VB program I use this code to do so.

Sub ImportData()
Dim strDB as String
Dim strXName As String
Dim ACC As Access.Application

strDB = "Db"
strXName = "D:\Data.xls"
Set ACC = OpenCurrentDatabase(strDB)

    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, _
    "tblSALGSTALL", strXName, True, "Grunnlag"

End Sub

This code works fine. But the problem is as follow: To use the code, all of
my users need to have a copy of Access, because the code opens Access.
--
mvh

HP

2. US-CA-ORACLE APPS DBA

3. HELP: **** DAO: Importing database tables from an ODBC source to an MS Access database

4. Excel to SQL Server

5. Make Tabel Query and ODBC

6. Excel

7. Additem to listbox from access tabel with numberfield ?

8. WHEREIS: TERA KNOWLEGE SYSTEMS ???

9. Delete all records in an Access tabel

10. How to insert a tab delimited file in an Access tabel

11. Adding Fields to an Access tabel using SQL

12. ODBC database crashing accessing progam going for an access database

13. Importing an Access 2000 table into another Access 2000 database with VB Code