Bilbo_Baggins_Esq
Registered User.
- Local time
- Today, 02:17
- Joined
- Jul 5, 2007
- Messages
- 586
In another thread, I posted a question with some code.
A user was kindly able to assist me resolve that particular code, but the code solution I presented is not nearly the ideal solution for me.
Yes, it works, but I can’t help but think there is a more appropriate way to achieve the goal.
So, obviously databases have certain properties, for example their file format, among other things.
Older databases, Access 2002-03 format and earlier, may also be encoded.
I would love to be able to detect these attributes directly.
Right now, my code locates and attempts to convert a database.
If the database is encoded, it fires an alert, and my code reads the error to see if it is an encoded alert.
If it successfully converts the database, my code concludes the database must not be encoded and then deletes the freshly created converted version.
Yes, this works, but is clunky and slow. Plus there are other messages which can fire and the code has to read them all before it is convinced the database is encoded or not.
So, for example, I alternatively have this code which will open a database and check it’s file format.
I can’t help but think there is a similar way to detect other attributes (or properties).
It would be GREAT to directly detect:
File version format (completed)
Encoded or not encoded
File password protected or not password protected
VBA Project password protected or not password protected
I am running Access 2010 (x86) so my available libraries are currently limited to those included with Office 2010.
I have dug and dug and searched the internet and help files.
If I know what library to obtain from prior versions, I can certainly get it/them.
The problem there is, I have no idea what to get.
So please guys and gals, I REALLY NEED the assistance of the masters here.
Is there some method or function or whatever, from Access 2010, OR EARLIER versions that I could use to gain this information directly?
Some clue where to look or what the method function is named?
Anything will help.
A user was kindly able to assist me resolve that particular code, but the code solution I presented is not nearly the ideal solution for me.
Yes, it works, but I can’t help but think there is a more appropriate way to achieve the goal.
So, obviously databases have certain properties, for example their file format, among other things.
Older databases, Access 2002-03 format and earlier, may also be encoded.
I would love to be able to detect these attributes directly.
Right now, my code locates and attempts to convert a database.
If the database is encoded, it fires an alert, and my code reads the error to see if it is an encoded alert.
If it successfully converts the database, my code concludes the database must not be encoded and then deletes the freshly created converted version.
Yes, this works, but is clunky and slow. Plus there are other messages which can fire and the code has to read them all before it is convinced the database is encoded or not.
So, for example, I alternatively have this code which will open a database and check it’s file format.
Code:
Sub OpenAccessTest()
Dim AccessObj As Object
Dim AccessPathIn As String
Dim AccessPathOut As String
Dim FormatResult As String
AccessPathIn = "C:\Testing\MMDemoEnecoded.mdb"
AccessPathOut = " C:\Testing\MMDemoEncoded_2k7.accdb"
Set AccessObj = CreateObject("Access.Application")
AccessObj.Application.OpenCurrentDatabase AccessPathIn, True
Select Case AccessObj.Application.CurrentProject.FileFormat
Case acFileFormatAccess2
FormatResult = "Microsoft Access 2"
Case acFileFormatAccess95
FormatResult = "Microsoft Access 95"
Case acFileFormatAccess97
FormatResult = "Microsoft Access 97"
Case acFileFormatAccess2000
FormatResult = "Microsoft Access 2000"
Case acFileFormatAccess2002
FormatResult = "Access 2002 - 2003"
Case acFileFormatAccess12
FormatResult = "Microsoft Access 2007"
End Select
MsgBox "This is a " & FormatResult & " project."
AccessObj.Application.CloseCurrentDatabase
Set AccessObj = Nothing
End Sub
It would be GREAT to directly detect:
File version format (completed)
Encoded or not encoded
File password protected or not password protected
VBA Project password protected or not password protected
I am running Access 2010 (x86) so my available libraries are currently limited to those included with Office 2010.
I have dug and dug and searched the internet and help files.
If I know what library to obtain from prior versions, I can certainly get it/them.
The problem there is, I have no idea what to get.
So please guys and gals, I REALLY NEED the assistance of the masters here.
Is there some method or function or whatever, from Access 2010, OR EARLIER versions that I could use to gain this information directly?
Some clue where to look or what the method function is named?
Anything will help.