If...then statement based on version of access

H

HeatherD25

I want to run a macro based on the version of access the person is using.

1) What is the statement do find out the version of access? What values
does it respond with?

In simplified terms I want to run a statement that says:

If Access 2003 Then
RunMacro2003
Else
Run Macro 2007

This is what I have:

DBversion = CurrentDb.Version

If DBversion > 12 Then
DoCmd.RunMacro Macro2007
Else
DoCmd.RunMacro Macro2003
End If

Help?

Thanks!!
 
D

Douglas J. Steele

Syscmd(acSysCmdAccessVer) will return 11.0 for Access 2003 and 12.0 for
Access 2007.

That having been said, why do you think you need to do this?
 
K

Klatuu

Currentdb.Version returns the version of the Jet database engine, not the
Access version.
For that, you need to use Application.Version
 
H

HeatherD25

Do you know where I can find a list of application.version will return in
order to build my if...then statements?
 
H

HeatherD25

I have a database that needs to work in Access 2003 and 2007. I needed to
export a report, but because of the limitation of 2007 to export a report I
set up a macro to export the query to excel to just give the data for the
report.

I created the macro in 2007 and it won't work in 2003. I think because the
"Output Format" of the macro has different selections in the two version.
2003 has "Microsoft Excel 97-2003 (*.xls)" and 2007 has "Excel 97 - Excel
2003 Workbook (*.xls)". There isn't a common selection on either of them so
they would be the same regardless of the version I'm using.

So I figured I could set up 2 different macros - one for 2007 and one for
2003. Then figure out the version and do an if/then/else to run the
appropriate macro.

I looked into doing a transferspreadsheet, but I want the user to be able to
select where to save the file and I couldn't find straightforward code to do
that.

Do you have any other ideas how I could accomplish what I'm trying to do?

Thanks!! :)
Heather
 
T

Tom Lake

HeatherD25 said:
Do you know where I can find a list of application.version will return in
order to build my if...then statements?

In 2007 Application.Version returns 12.0 so you could use

DBversion = Application.Version
If DBversion >= 12 Then
DoCmd.RunMacro Macro2007
Else
DoCmd.RunMacro Macro2003
End If

Tom Lake
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top