-
Sep 20th, 2024, 11:17 AM
#1
Connection String to Access 2021
I use the VB6 and Earlier Forum a lot, but I could not get a good (working) answer to my issue.
I have, on a Windows 11 computer (laptop), the MS Office 2021 Pro (which ships with MSAccess 2021---cheaper variants of 2021 don't include Access).
I have googled, AI'd and posted a thread in August on the issue I have of not being able to connect VB6 to .accdb files created in Office 2021. Wikipedia says that Office 2021 is version 17.0. When I check the version on my laptop (using VB6 code), it returns 16.0.
So, I tried both in my connection strings as follows. In both, I always get the error "Provider cannot be found. It may not be properly installed."
Here is my TEST example. The database does exist in the same directory as the project.
Code:
Private Sub Form_Load()
Dim cnn as ADODB.Connection
Dim cmd as ADODB.Command
Dim rs as ADODB.Recordset
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.ACE.OLEDB.16.0;" 'I also tried 17.0
.ConnectionString = "User ID=Admin;password=;" & " Data Source = " & App.Path & "\Database1.accdb"
End With
Sam I am (as well as Confused at times).
-
Sep 20th, 2024, 02:30 PM
#2
Re: Connection String to Access 2021
The ACE provider comes as either a 32bit version (which you need for VB6 programs) or as a 64bit version.
I'd guess that you installed the 64bit version of Office, so got the 64 bit provider. Try downloading the 32bit version from Microsoft, and see if that works for you.
https://www.microsoft.com/en-us/down....aspx?id=54920 (the X64 one is 64bit, so install the other).
-
Sep 20th, 2024, 03:57 PM
#3
Re: Connection String to Access 2021
Well...that's odd. I have NEVER downloaded a MSAccess Database Engine program. And all works using Office 2007. I did get the 64 Bit version of Office 2021 (I THINK, anyway...tried to determine that on the laptop, but no way Jose could I find it...but, because it is relatively new, I suspect is 64. I'll see if getting the 32 bit version of MSAccess Database Engine and see if that is my issue. I had received from chatGPT that I was probably missing this software.
Thanks...I'll post once I do and results there of.
Sam
Sam I am (as well as Confused at times).
-
Sep 20th, 2024, 04:07 PM
#4
Re: Connection String to Access 2021
 Originally Posted by SamOscarBrown
Well...that's odd. I have NEVER downloaded a MSAccess Database Engine program.
It automatically gets installed along with Office, but you only get the 32bit or 64bit version - to match the version of Office you installed.
Presumably you always installed the 32bit version of Office before, but went for 64bit this time.
-
Sep 20th, 2024, 08:37 PM
#5
Re: Connection String to Access 2021
That would be correct. I did use 32bit office before, and ASSUME the new one is 64.
BUT, I do not see any "Access Engine" actually being installed in the Control Panel/Programs. If I download the separate engine (from that link), will it appear in the Installed Programs list or not...any idea?
Not wanting to 'mess things up' on the new laptop (I'll save all that stuff for later as I always do!!! )
Sam I am (as well as Confused at times).
-
Sep 21st, 2024, 05:41 AM
#6
Re: Connection String to Access 2021
For some time after providing Office in 64-bit form, Microsoft recommended that most people install the 32-bit edition for compatibility reasons and install the 64-bit edition only if you needed the few extra features it provided, e.g. effectively unlimited-size Excel sheets. Nowadays, installing Office will default to 64-bit and you have specifically select 32-bit if you want it. The Access database engine will not show up as its own component when installed as part of Office because you can't modify or uninstall it, but it will show up if you install it standalone, because how else could you uninstall it?
-
Sep 23rd, 2024, 01:01 AM
#7
Re: Connection String to Access 2021
 Originally Posted by SamOscarBrown
I did get the 64 Bit version of Office 2021 (I THINK, anyway...tried to determine that on the laptop, but no way Jose could I find it...but, because it is relatively new, I suspect is 64.
Sam
Easy to find out:
c:\Program Files\Microsoft Office\root\OfficeXX
with "XX" being the Version
Check if it's there, and then look inside the Folder if you can find Excel.exe etc.
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|