Update a field in Access from Excel

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,097
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hi.. run into a problem. Although my code did work with an .accdb file, attempting this with a particular file results in
The database you are trying to open requires a newer version of Microsoft Access.
VBA Code:
Function getConn() As ADODB.Connection
    Dim rv As New ADODB.Connection
    Dim strConn As String
    strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source = O:\DB001.accdb"
    rv.Open strConn
    Set getConn = rv
End Function
I guess this means there are different types of accdb. I also tried DAO but the same problem.
Is there a solution? I need to update one record in DB001 which triggers a further event (in Access).
Excel is Office 2010 and Access Office 2019, and O: is mapped drive on LAN.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I have not experienced this error but
I guess this means there are different types of accdb.
no, there is not (per se). However, there are differences between Access versions and if the one you are trying to open uses advanced features, an older version will not be able to open it. You should also look into provider connection strings that match your versions - you may need to use OLDB.16.0 and not 12.0
 
Upvote 0
I'd like to try OLDB 16 but can't find a 32bit download link that I'm sure is right. Would you have one ?
 
Upvote 0
Sorry, no. I've had little use for ADO over the years. I can suggest that you can push/pull data from one app to the other using what was (is?) called automation. For that I'd suggest you go here.

Your thread title suggests you want to update Access table(s) from Excel as you posted in Excel questions, but I think you're trying to update an Access table from another Access db and there might be other/easier ways than ADO. One might be the automation link I provided. Another might be to link the remote table in your active db so that you have access to it. Another might be a query that accesses the remote db using the IN operator and the full path to the remote db. However, I cannot recall if that works for action queries (queries that append, delete or update) or just Select queries but you could check it out. The syntax for Select would be like

SELECT Field1, Field2... FROM tblTheTable IN ("C:\Databases\...\TheDatabase.accdb")

I guess you could also try that with update, append or delete.
 
Upvote 0
Thanks for the info and some interesting stuff in that link. It is Export Excel to Access that's wanted and the target db is the wrong Format. My routine works with some dbs but I'm not sure why the difference. I had thought it was just the mdb or accdb extension, The idea of trying Ace v16 instead of 12 was worth a try, but I still can't find it or even a filename for it.
You never know what you can trust from Google... or what malware will show up as a result! They usually want you to log in or sign up etc.
So I can either try using a text file, or write a compliant Access file (a copy of one that works) and the target db links to that.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top