Heenan, Lambert
Lambert.Heenan at AIG.com
Tue Jul 29 10:35:39 CDT 2008
Believe it or not I had thought of using SysCmd(acSysCmdAccessVer)too, but I dismissed that as I was thinking along the lines of lngAccessVersion = CLng(SysCmd(acSysCmdAccessVer)) If lngAccessVersion > 9 Then SetOption "Default File Format", acFileFormatAccess2000 End If This of course would not work because the compiler would still see and attempt to parse the offending constant name, but "#if" is a compiler directive, not a VBA control structure, so it does work. It's saying to the compiler "don't even look here it the version number is less than 9". Glad to help in my roundabout way. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Tuesday, July 29, 2008 11:19 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Default File Format Hi Lambert - thanks for your help. I don't know whether to be angry or happy - I've been developing for 10 years and didn't know this could be done. Anyway, this is what is now working in Access 2000 and in Access 2003: lngAccessVersion = CLng(SysCmd(acSysCmdAccessVer)) #If lngAccessVersion > 9 Then SetOption "Default File Format", acFileFormatAccess2000 #End If When I walk through this code in Access 2000, the cursor completely skips the three lines bounded by #. Thanks Again! Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Tuesday, July 29, 2008 8:48 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Default File Format P.S. You can also set conditional compiler constant in the VBA IDE, see http://support.microsoft.com/kb/274324 By doing so you can compile the same code base into different versions without needing to touch the actual code modules. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Monday, July 28, 2008 5:02 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Default File Format No difference huh? Just stupid "anti-word wrap". The #End If needs to be on a new line, just like I typed it in the first place. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Monday, July 28, 2008 4:50 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Default File Format Correction #if not ACCESS2000 SetOption "Default File Format", acFileFormatAccess2000 #End If -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert Sent: Monday, July 28, 2008 4:39 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Default File Format In the problem module declare a compiler constant.... #Const ACCESS2000 = True Then further down in the module #if not ACCESS2000 SetOption "Default File Format", acFileFormatAccess2000 #End If You will have to set the compile constant to False for all the other users. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Monday, July 28, 2008 3:43 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Default File Format In my library file, with is identical at each customer, is a SetOption method to set the Default File Format to Access 2000. The code is this: SetOption "Default File Format", acFileFormatAccess2000 However, I'm setting up a new customer who uses Access 2000, the above Option doesn't exist, and compiling fails. How can I set up a procedure which will ensure that this code line works in Access 2002 and 2003, and does compile in Access 2000? I tried to do something with late binding, but that didn't seem to work. Thanks! Dan -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com