Roger Van Laere Bronze Collection
If, as part of starting up your application, you test to determine the current version of Access using SysCmd(acSysCmdAccessVer), you can run into a death trap right at the start of your program. The problem is that SysCmd(acSysCmdAccessVer) returns a string (for example, "8.0" for Access 97). For instance, a typical use of the function is to compare an integer version of its return value against a numeric to determine Access's major version number. That test might look like this:
If SysCmd(acSysCmdAccessVer) = 7 Then Exit |
Your code will work as long as the setting for the decimal sign is the point. The problem is that in a lot of countries, the decimal sign is the comma. This test will return true in North America:
CSng("8.0") = 8 |
On the other hand, this test will return true in most of the rest of the world:
CSng("8.0") = 80 |
A workaround is to use the Mid or Left functions to get the first character of the string returned by SysCmd(acSysCmdAccessVer):
If Left(SysCmd(acSysCmdAccessVer),1) = 7 Then Exit |
Other functions and property settings, which return a decimal number in the form of a string, can lead to the same kind of problems. Using the Mid function might not always be an option. In those cases a more elaborate workaround is to retrieve the setting for the decimal sign from HKEY_CURRENT_USER\Control Panel\International\sDecimal and write code for each different case.
Even if you're not currently planning to let your Access application go abroad, you'd be wise to test it against a changed decimal indicator now. It might save you a lot of grief down the road.