WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Access

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Get Access Version That Created MDB File


Question:

We are in the process of converting the data for one of our programs from Jet 3.5 data to Jet 4 (Access 97 to 2000). Does anyone know of a way to determine if an Access DB is Access 97 or 2000 via ODBC or other methods? I'd like to find out how much of our data has already converted.

Answer:

Here is some code that should work:
; Winbatch 2004G - 
; Get version of Access Application
; Useful to check prior to loading an MDB file, but
; cannot be used to tell which version created the MDB
;  8.0 = Access 97
;  9.0 = Access 2000
; 10.0 = Access 2002(XP)
; 11.0 = Access 2003 
;
; Stan Littlefield
;///////////////////////////////////////////////////////////////////////////

acSysCmdAccessVer=7
oAcc = CreateObject("Access.Application")

Message("Access Version",oAcc.SysCmd(acSysCmdAccessVer) )

oAcc=0
Exit
Or here is some other code:

; Version Information Example WinBatch Script
cMDB           = AskFileName("Select ACCESS Database",".\","MDB Files|*.mdb|","*.mdb",1)
cConn          = StrCat("Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=",cMDB)
; or if password protected
;cConn         = StrCat("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=",cMDB,";Jet OLEDB:Database Password=test"")
DB             = ObjectOpen("ADODB.Connection")
DB.Open(cConn)
objProp = DB.Properties
objItem = objProp.Item('Jet OLEDB:Engine Type')
ver = objItem.Value

Switch ver
	Case 4
		verstr = "97"
		break
	Case 5
		verstr = "2000"
		break
	Case ver
		verstr = "*UNKNOWN""
		break
EndSwitch
msg = StrCat("'",cMDB,"' was created using Access version ", verstr)
Message("Version Finder",msg)
ObjectClose(objItem)
ObjectClose(objProp)
ObjectClose(DB)
Reference:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&frame=right&th=c85bbb056a9a5f3a&seekm=3eb4d93d%40newsgroups.borland.com#s
Article ID:   W16595
File Created: 2005:02:18:12:21:34
Last Updated: 2005:02:18:12:21:34