+ Reply to Thread
Results 1 to 2 of 2

Still Having Trouble with Excel to Access

Hybrid View

  1. #1
    Valued Forum Contributor gjlindn's Avatar
    Join Date
    08-01-2011
    Location
    Dodgeville, WI
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    369

    Re: Still Having Trouble with Excel to Access

    Hi Vladamir. In your module FromExcelToAccess you're attempting to run an insert query by refreshing an excel query table...that can't be done. You need to execute an insert statement. I don't know the ODBC method all that well; I use ADO. Here's what I'd do:
    Public oCon As ADODB.Connection
    
    Sub FromExcelToAccess()
         OpenDB
         oCon.Execute "INSERT INTO Table1 ( [Date], [UserName], DwgNo, Description, Material, QuoteNum, Status ) Select '06/21/2012', 'FLG-p', " & _
              Range("F10") & ", 'Some Text 42 x 77', 'Alum', '103112', 'Approved'"
        oCon.Close
    End Sub
    
    Sub OpenDB()
        Set oCon = CreateObject("ADODB.Connection")
        oCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\MyFiles\db1.mdb;"
    End Sub
    Last edited by gjlindn; 06-30-2012 at 12:08 AM.
    -Greg If this is helpful, pls click Star icon in lower left corner

+ 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