1

I am fairly new to VBA but am trying to upload data from an Excel Workbook to an Access database table from a computer that does not have Access installed. I have searched for a solution online but haven't found anything yet that I can get to work with my code.

The error code I am getting is...429 cannot create activex component

I have some VBA code set up in the Excel workbook which calls a Sub in Access [which works on a machine which has Access installed] but I don't know what the correct code should be if the machine doesn't have Access installed.

Sub Upload_SiteObsData_Excel_To_Access(Database_Path)

Database_Path = "\\Path\db1.mdb"

Dim acApp As Object
Dim db As Object

Set acApp = CreateObject("Access.Application")

acApp.OpenCurrentDatabase ("\\Path\db1.mdb")

Set db = acApp
acApp.Run "Upload_SiteObsData_to_Access"
acApp.Quit
Set acApp = Nothing

End Sub

The procedure in Access is as follows:

Option Compare Database
Option Explicit

Dim Excel_Path As String
Dim Excel_Range As String
Dim UserNameOffice As String

Dim Excel_File_TechForm As String
Sub SetUp_Variables()

UserNameOffice = CreateObject("wscript.network").UserName

Excel_Path = "C:\Documents and Settings\" & UserNameOffice & "\Desktop\"
Excel_Range = "MyData"

Excel_File_TechForm = "SiteObsForm_v0.2.xls"

End Sub

Sub Upload_SiteObsData_to_Access()

SetUp_Variables
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TBL_SiteObsData",   Excel_Path & Excel_File_TechForm, True

End Sub

I would be extremely grateful for any help. Thanks in advance

2
  • you dont have to open access to access the db. you can run any other compatible tool to open the db. Have a read on ADODB and different sql strings Commented May 1, 2013 at 10:41
  • @user2338876 Yoy may have a look at Acess Runtime Commented May 1, 2013 at 11:56

3 Answers 3

1

I was just fooling around with some Excel VBA code and the following seemed to work:

Option Explicit

Sub Upload_Excel_to_Access()
Dim con As Object  '' ADODB.Connection
Set con = CreateObject("ADODB.Connection")  '' New ADODB.Connection
con.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data source=C:\Users\Public\Database1.accdb;"
con.Execute _
        "INSERT INTO TBL_SiteObsData " & _
        "SELECT * FROM [Excel 12.0 Xml;HDR=YES;IMEX=2;ACCDB=YES;DATABASE=C:\Users\Public\Book1.xlsm].[Sheet1$]"
con.Close
Set con = Nothing
End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

Hi Gord, Looks good. I notice you are using Office 2010...we are still running Office 2003. Do you know what the syntax should be for 2003 and I can give it a try. Many thanks
0

I think you'l have to find another way round this issue, without access installed, Excel cannot create the "Access.Application" object, it just flat-out doesn't know what access is.

Can you pull the data from Access instead?

3 Comments

Hi, It's purpose is to upload form data from several users located in different geographical areas [but connected to the same network] to master database. Installing Access on each computer is an added expense we were trying to avoid.
Is someone running the access application, or is it just a datastore?
Access is just the datastore
0

I've done this the first time I connected Excel to Access via VBA, and I know for sure it works using the code that Gord Thomson provided. Establishing an ADODB connection and executing an append query.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.