- NSIS Discussion
- How do I choose which version of Microsoft Access database to install?
Archive: How do I choose which version of Microsoft Access database to install?
davidhop
6th May 2003 16:15 UTC
How do I choose which version of Microsoft Access database to install?
I write stuff in Access VBA for Microsoft Office (some of us have to!)
I can figure out from the registry which version of Access the user has installed, and then I want to choose which version of the database to install.
In the language I'm familiar with, what I want to do is:
AccessVer=CheckVersion
SelectCase AccessVer
Case 1
database97Install
Case 2
database2000Install
Case 3
databaseXPInstall
Case else
msgbox "Go away, you don't have Access installed"
End Select
I've got the version from the registry into $4 which, with StrCmp I can use to generate messages, but how to I use this to get the installer to install different versions.
Can anyone help - is that what this prefunc stuff is for? Probably very obvious, but I only just got into this.
Afrow UK
6th May 2003 17:12 UTC
Get strcmp to target a definate place in the section, e.g.
Section ""
StrCmp $4 database97 database97Install
StrCmp $4 database2000 database2000Install
StrCmp $4 databaseXP databaseXPInstall
Goto end
database97Install:
...Files to extract for database97 in here...
Goto end
database2000Install:
...Files to extract for database2000 in here...
Goto end
databaseXPInstall:
...Files to extract for databaseXP in here...
end:
SectionEnd
-Stu
davidhop
6th May 2003 18:12 UTC
Very useful but ...
I'm feeling particularly dim about this!:o
What do I actually put in substitution for
...Files to extract for database97 in here...
I mean how do you write that?
SetOutPath $INSTDIR
File /r AuditorFiles97\*.*
Joost Verburg
6th May 2003 18:38 UTC
For example, if you want to extract a file called database.dat, use something like this:
File /oname=database.dat 97.dat
This will extract the file database.dat (with the data stored in 97.dat on your PC).
If they don't need to have the same filename, you don't have to use /oname=?.
If you put 'em in the same directory, you only have to use SetOutPath once, before the version check.
davidhop
6th May 2003 18:50 UTC
TQ
Thanks for that Joost (and Stu) - will give it a hack.
dajvid
12th May 2003 05:05 UTC
Hi David,
I'm wondering whether you can post your code to detect what version of Access is installed on the computer. I'm having varying amounts of success trying to write the code myself.
Thanks,
Dave.
davidhop
12th May 2003 11:32 UTC
Code coming
Will certainly post code when it is done - but just blew up my app with a new 'feature' so got diverted from install routine!
(and just seem to have unsubscribed myself from this thread - the screen said - so hope this is logged!)
If you want where I have got to so far, post back, but I have to have something clean by Thursday anyway, so I'll put the finished code up then.
So far as I can see the key is this
EnumRegKey $R0 HKEY_LOCAL_MACHINE "Software\Microsoft\Office\8.0\Access" 0
StrCmp $R0 "" not8 got8
if you run this for 8=97, 9=2000 and 10=XP you know what is installed (according to the Registry anyway) and can then decide what to install (or nothing if no Access is found).
XP seems to run 2000 stuff no probs. but I have to use different mde for 97.
kichik
12th May 2003 12:43 UTC
This Archive directory might help too.
davidhop
12th May 2003 19:46 UTC
Neat
TQ - that's a useful ref.
First item on the list gets you the install path for Access - and being blinkered by a deadline right now I forgot about all the other stuff that lies buried below the reg key!
dajvid
15th May 2003 04:50 UTC
Thanks for the reference Kichik - I was looking in the "How to detect if ... is installed" instead, which didn't have any relevant scripts.
David, I can confirm for you that, as you suspected, Access XP is able to run Access 2000 files without conversion, however Access 97 needs Access 97 files. Hope you meet your deadline!
Ta,
Dave.
davidhop
16th May 2003 13:24 UTC
Some code
As promised here is the script that I used to install the right version of an Access App. I'm sure it could be more elegant - but it worked and if I'll stick up the next version if I get there.
One odd thing I couldn't get round was that when I wrote a version with different components, I couldn't figure out how to fix the filesize being reported in the relevant section. With either of two files to be installed (conditional of Access version) the component dialog reported the install filesize as being the sum of both.
A small thing to be hacked around later.