+ Reply to Thread
Results 1 to 2 of 2

savin from excel sheet to MSAccess

  1. #1
    Medhat
    Guest

    savin from excel sheet to MSAccess

    Hi all,
    need help on how to save a few certain cells in excel sheet to msaccess.
    all help needed
    regards



  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello

    if you want to add records to an existing Access Table , you may try


    Sub exportDonnees_Excel_Vers_Access()
    'Activate Microsoft ActiveX Data Objects x.x Library
    Dim Conn As New ADODB.Connection
    Dim rsT As New ADODB.Recordset
    Dim maTable As String

    maTable = "Table1" ' Table name

    With Conn
    .Provider = "Microsoft.JET.OLEDB.4.0"
    .Open "C:\Documents and Settings\michel\Excel\MaBase_V01.mdb"
    End With

    With rsT
    .ActiveConnection = Conn
    .Open maTable, LockType:=adLockOptimistic
    End With

    With rsT
    .AddNew
    .Fields(0).Value = Range("A1")
    .Fields(1).Value = Range("B1")
    .Fields(2).Value = Range("C1")
    .Update
    End With

    rsT.Close
    Conn.Close
    End Sub



    Regards ,
    michel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1