Converting mdb file to accdb (1 Viewer)

kirkm

Registered User.
Local time
Today, 22:11
Joined
Oct 30, 2008
Messages
1,257
This as a learning curve and also to improve routimes written years ago that now might be improved.
I hope I can use this thread to ask questions when I get stuck.

Much of the code I didn't write and haven't always understood.
Something in this category is the following

Code:
Declare Function GetWindowsDirectory2 Lib "Kernel32" Alias "GetWindowsDirectoryA" (ByVal p$, ByVal s%) As Long
Function sGetWinDir() As String
    Dim sPath As String
    sPath = String(255, Chr$(0))
    sGetWinDir = Left(sPath, GetWindowsDirectory2(sPath, Len(sPath)))
End Function
This returns the Windows folder name. But perhaps there's a simpler method? The "Private Declare" stuff I've never fathomed
and although it works, perhaps it'd be good to replace it with something more straightforward? Also the reference to Kernel32 on a 64 bit machine is/is not OK ?

Thanks for any help.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:11
Joined
Oct 29, 2018
Messages
21,357
Hi. One replacement could be FileSystemObject, but not sure off the top of my head. Are you using 64-bit Office? If so, you'll need to adjust all your API calls for 64-bit.
 

kirkm

Registered User.
Local time
Today, 22:11
Joined
Oct 30, 2008
Messages
1,257
No it's 32 bit office... I was getting confused with Windows...
Just tried FileSystemObject but don't see anything there to get the Windows path
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:11
Joined
Oct 29, 2018
Messages
21,357
No it's 32 bit office... I was getting confused with Windows...
Just tried FileSystemObject but don't see anything there to get the Windows path
Hmm, did you try this one maybe? Sorry, I can't test it right now for you.
 
Last edited:

kirkm

Registered User.
Local time
Today, 22:11
Joined
Oct 30, 2008
Messages
1,257
Thank you! I had been (almost) there but missed the crucial bit.
Now working...
 

Users who are viewing this thread

Top Bottom