Can you change System Format in VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Perissos
    New Member
    • Sep 2010
    • 6

    #1

    Can you change System Format in VBA

    I have built a wonderful database that I had to share with someone in Brazil. Unfortunately because his system format is set to Portugese(Brazi l) the database works incorrectly.

    Is there a way to have his system read the vba code in Access or do I need to build two sets of code for the same database, or do I really need two seperate databases?

    I have never worked with international builds before so this is completely new territory to me.
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Different language versions aren't solved well by MS.
    Personally I always work in a US version and executing that in another language will work always.

    The main problem is in using the objects (like "Form!") in your queries as Access will translate them automatically into the language of the Access version. The A2007/A2010 version is even blunt enough not to recognize the "Empty" string in the startup form from the actions panel when not in the right language.

    So my advise to you is to construct/move the database in a US version, cleanup the errors (Like the mentioned "Form!" references in your queries) and then deliver it in Spanish and Portuguese.

    Nic;o)

    Comment

    • Cynthia Forner

      #3
      Thank you. the database as constructed in the US version. It only had an issue when it was given to that one person. All the other countries (4 total) it worked fine.

      The error that it was getting was a syntax error and it seemed to put semi-colons where commas usually are in the modules. Everything else worked beautifully. Or I should say appears to work beautifully. He is still testing the application.

      I appreciate your response. Thank you so much. I have found that even though I know a lot.. I still have much to learn.

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        Advise that person to change the Regional settings in the Control Panel, as Access will use them for a number of tasks.

        Nic;o)

        Comment

        • Perissos
          New Member
          • Sep 2010
          • 6

          #5
          We did that to get it to work, but wouldn't that mean he would always have to change it back and forth in order to complete other tasks?

          Comment

          • nico5038
            Recognized Expert Specialist
            • Nov 2006
            • 3080

            #6
            You could change the code to replace the semicolons with comma's when it's all in stringing expressions.
            The trick is to assign the string first and inspect the result with an Instr() function. I used it e.g. to find out what currency sign is used on a user PC.

            Another option would be to code the change of the regional setting in the database when started and change it back when ready. This will however temporary "disable" the feature for other applications.

            In general a list separator isn't that important for a user, thus I expect that changing it once just for the sake of running the database won't be a problem.

            Nic;o)

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32669

              #7
              If I were in your situation, I'd determine the likely problems with the location settings of the PC at the start, and write your code to handle this in those places where you know it will struggle.

              You already have experience of where many of these are from your Brazilian colleague.

              Determine the problems your code falls over. Do them basically in US mode, then in those areas add an If statement afterwards to convert where necessary. Just as an EG, if you had a numeric value of 12,326.02 which needed to be converted to the standard European mainland version of 12.326,02 then something like :
              Code:
              strFormatted = Format(dblValue, "#,##0.00")
              If Not blnCompatible Then
                  strFormatted = Replace(strFormatted, ",", "@")
                  strFormatted = Replace(strFormatted, ".", ",")
                  strFormatted = Replace(strFormatted, "@", ".")
              End If
              This is simply an example to convey the general idea. You would need to handle each situation as you were aware of them. Good luck.

              Comment

              Working...