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
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