Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open MS Access bypassing the autoexec.

Status
Not open for further replies.

Trebor100

Programmer
Mar 14, 2006
90
GB
All - i'm having problems getting the MS Access version of a database. I am using the following function:

Function GetMdbVersion(l_Mde)
on error resume next
Dim l_AVer
Dim l_Acc
Set l_Acc = CreateObject("Access.Application")
l_Acc.AutomationSecurity = 3
l_Acc.SendKeys("+")
l_Acc.OpenCurrentDatabase l_Mde, false
l_AVer =l_Acc.CurrentDB.Properties("AccessVersion")
Select Case l_AVer
case "02.00" : GetMdbVersion = "Access 2.0"
case "06.68" : GetMdbVersion = "Access 95"
case "07.53" : GetMdbVersion = "Access 97"
case "08.50" : GetMdbVersion = "Access 2000"
case "09.50" : GetMdbVersion = "Access 2002/2003"
Case Else GetMdbVersion = "Unknown Access version (" & l_AVer & ")"
End Select

l_Acc.CloseCurrentDatabase
l_Acc.Quit
Set l_Acc = nothing
if err.number > 0 then
GetMdbVersion = "V. Check Error (" & err.number & ")"
err.number = 0
end if
End Function

The function works great however the autoexec routine in the access dbs is fired. Does anyone know how to bypass this? i thought the sendkeys would fix the issue however it doesn't.

Also if anyone knows of another way / method to get the access version of an mdb via a script which avoids this mess then please let me know.

Regards,
Rob
 
Correct on function:

Function GetMdbVersion(l_Mde)
on error resume next
Dim l_AVer
Dim l_Acc
Set l_Acc = CreateObject("Access.Application")
l_Acc.SendKeys("+")
l_Acc.OpenCurrentDatabase (l_Mde )
l_AVer =l_Acc.CurrentDB.Properties("AccessVersion")
Select Case l_AVer
case "02.00" : GetMdbVersion = "Access 2.0"
case "06.68" : GetMdbVersion = "Access 95"
case "07.53" : GetMdbVersion = "Access 97"
case "08.50" : GetMdbVersion = "Access 2000"
case "09.50" : GetMdbVersion = "Access 2002/2003"
Case Else GetMdbVersion = "Unknown Access version (" & l_AVer & ")"
End Select

end function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top