locked
VBA compiler error with German characters in code. RRS feed

  • Question

  • Hi.

    We have a Windows10, 64 Bit with Office365 64 Bit.

    When I use German special character (öäü..) in Ms Access VBA Code, then I receive an compiling error.

    When I search on words with special characters, then I receive the search box with a '?' for the special character.

    Strange, because many clients don’t have the problem.

    What can I doo?

    Tuesday, February 11, 2020 9:11 AM

All replies

  • I suppose VBA code editor can deal with only ASCII characters.
    Please use "Courier New" Font as a VBA standard font. 

    Ashidacchi -- http://hokusosha.com

    Tuesday, February 11, 2020 10:04 AM
  • I know when I program, with the exception of comments, I never deviate from using plain English characters [A-Za-z].  I do the same for objects, fields, controls and the likes.

    Daniel Pineault, 2010-2019 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Tuesday, February 11, 2020 11:36 AM
  • It may depends on which Windows language packs are installed.

    On my US-EN system, some characters above 255 work, such as:

    Dim s As String
    s = "öäü " & ChrW(&H152)     'OE smashed together,
    MsgBox s
    Debug.Print s

    But replacing the next value for a Korean character resulted in ? in the msgbox.
    The first 3 chars work because they are <255.

    Use Character Map to explore characters and their ascii values.

    Note that the immediate window is a bit braindead and cannot display such characters, but VBA itself can: a string is a unicode string under the hood (BSTR). This is a COM requirement.


    -Tom. Microsoft Access MVP

    Tuesday, February 11, 2020 2:09 PM
  • Hi Peter,

    As Tom pointed out. You might want to check the Installation of Office/Access and Windows. In the Settings, look for MS Office - run it (not uninstall) - check under custom for any language install (German) and Windows 10 as well.

    HTH

    Wednesday, February 12, 2020 4:12 AM
  • Hi, thanks for the answer.

    Yes, i think this is a problem with language packs.

    Now I can check the installed windows language pack.

    How can I check or set the office/access language pack?

    When I lunch Settings, Ms Office I can only rapair the installation.

    Thanks, Peter

    Wednesday, February 12, 2020 7:17 AM
  • Hi.

    Now I have checked all language settings.

    The system language and the office language are Germany.

    But the error remains.

    I have the problem on 2 of 100 computers.

    These computers were delivered pre-configured.

    I have prepared a very simple example, nut I can`t post links.

    Other forms refer to different versions of

    C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\VBA\VBA7.1

    Now I work one week on this problem….

    Thanks, Peter

    Wednesday, February 12, 2020 9:08 AM
  • Hello

    Maybe I should better describe the problem:

    A Form contains a textfiled with the name = 'Stück'.

    On VB I can not point to Me.Stück.

    I recive a compiler error and at runtime, Access can not communicate with OLE-Server or ActiveX component.

    This is a new preconfigured computer with W10 and Office365 64 Bit.

    You can find the example on:

    www.architext.it/DL/German_Special.zip

    Thanks, Peter



    Wednesday, February 12, 2020 2:02 PM
  • On VB I can not point to Me.Stück.

    Hi Peter,

    What happens if you use:    Me.[Stück]    or    Me("Stück")?

    Personnaly, I never use special characters in objectnames (fields, controls, …). But, if necessary, I can "display" these special characters for the user.

    Imb.


    • Edited by Imb-hb Wednesday, February 12, 2020 3:01 PM
    Wednesday, February 12, 2020 3:01 PM
  • Thanks.

    Unfortunately I need a solution to the problem. I contact MS

    Thanks, Peter

    Thursday, February 13, 2020 7:05 AM
  • Hi Peter,

    I recall that VBA coding must be in English and all Controls like Textbox, Listbox..etc as well. I might be wrong as I don't program in other written language. 

    Perhaps, you would try "Me.Stuck" in English.

    PS. BTW, did VBA intellisense dropdown appeared for the control name when you type "Me.". When you key-in a period after "Me"?
    • Edited by AccessVandal Friday, February 14, 2020 3:40 AM add
    Friday, February 14, 2020 3:37 AM
  • If this is happening only on Windows 10 64-bit machines, then make sure you read and understand how to convert VBA code written on a 32-bit machine to Windows 10 64-bit. The article below shows how to convert:

    https://docs.microsoft.com/en-us/office/vba/Language/Concepts/Getting-Started/64-bit-visual-basic-for-applications-overview

    This could be part of the problem. If you don't use PrtSafe in your Declare statements you will get compile errors.

    Friday, February 14, 2020 6:05 PM