How to copy data from an excel cell into a field in access table

Joined
Jan 27, 2013
Messages
1
Reaction score
0
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top