The CreateObject from VBA Excel gives error 409 while openning Access Runtime...

jaryszek

Registered User.
Local time
Today, 14:56
Joined
Aug 25, 2016
Messages
756
Hi Gurus,

according to this link below is not possible to open Access from VBA using method CreateObject ("Access.Application")

https://support.microsoft.com/en-us/kb/295179

How can i open Access database using VBA from EXcel and connecting to Access RunTime?

I have to have connection to access to do:
1. add row to existing table
2. refresh existing query.

Code:
Set rs = New ADODB.Recordset

rs.Open "tb_wpisy", Connectstr, adOpenKeyset, adLockOptimistic, adCmdTable

With rs
    .AddNew
    ![NumerSpółki] = TicketNumber
    ![User] = Login
    .Update
    .Save
    .Close
End With
'
'AccessApp.Visible = True

AccessApp.OpenCurrentDatabase (Lokalizacja_Pliku)
AccessApp.docmd.openquery "qry_tb_wpisy", 0, 1
AccessApp.CurrentDatabase.Execute ("UPDATE qry_tb_wpisy"), 0

Set rsQuery = New ADODB.Recordset
rsQuery.Open "qry_tb_wpisy", Connectstr, True, True

With rsQuery
    .Update
    .Save
'    NumerZgłoszenia = ![NumerZgłoszenia]
End With
    
Set rs = Nothing
Set rsQuery = Nothing

Maybe Did you have also a problem connected to mine?

Please help,
Warm Regards,
Jacek Antek
 
From what application do you want to create this access object?

If all you need is data, why don't you just create an ADODB connection to it and then run your queries or pull your recordset through that connection?

I notice in the code you listed you're trying to create an ADODB recordset but to do that, you have to first create an ADODB connection to the database.
 

Users who are viewing this thread

Back
Top Bottom