Results 1 to 1 of 1

How to copy data from a cell in excel onto a field in a table in access db using vba

Threaded View

  1. #1
    Registered User
    Join Date
    01-27-2013
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    1

    How to copy data from a cell in excel onto a field in a table in access db using vba

    So I am trying to type data into cell B9535 in excel and use an ActiveX submit button to have this data appended to a table called 'tblImport' in Access to the Field called 'SalesOrderID'
    Here is the code:
    Private Sub Submit_Click()
    Dim dbConn
    Set dbConn = CreateObject("ADODB.Connection")
    With dbConn
    .Provider = "Microsoft.ACE.OLEDB.12.0"
    .Open "db path here"
    End With
    End Sub
    Private Function InsertRecord()
    Dim strSQL As String
    strSQL = "Insert INTO tblImport(SalesOrderID) VALUES ('=Range" 'B''9535'"')"
    dbConn.Execute strSQL
    End Function
    Private Sub Form_Terminate()
    dbConn.Close
    Set dbConn = Nothing
    End Sub
    When I compile the code, there are no errors, nothing is appended in access.
    Please help!

    Moderator's Note: Welcome to the forum. Btw when posting codes be sure to enclosed the with code tags. Select the codes then hit the "#" symbol. I'll do it for you now. Thanks.
    Last edited by vlady; 01-27-2013 at 10:25 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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