Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2009
    Posts
    12

    Lightbulb CrashMaker

    this SOMETIMES crashes, but in one build allways...
    dim lcItem$


    lcItem = Replace(lcItem, Chr(0), "")
    -----
    lcItem = Replace(lcItem, Chr$(0), "")...and this NOT

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What exactly are you trying to accomplish with your code. It does not look too useful to me; unless you are trying to crash Access. Your Dim statement will create a Variant variable and not a String, in case you didn't know that. The $ means very little in VBA.

  3. #3
    Join Date
    Mar 2009
    Posts
    12
    Hi, OK, may be...
    Dim lcItem As String ' NOT lcItem$
    lcItem = Replace(lcItem, vbNullChar, vbNullString) ' OK
    -------------------------
    i am removing vbNullChar from my string
    But such 'lcItem$' i have EVERYWHERE in my code
    I have Crash problems now
    OK, i replace all suffixes ('$' ,...) with explicit declaration (as string ,..)


  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    String variables are initialized to a ZLS (ZeroLengthString) and if I remember correctly, Nulls are not allowed in Strings in VBA.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I looks like I will have to apologize for the misleading info I gave you. Apparently the VB Type Declaration Characters are alive and well within VBA just not used very much. I'm still wondering why you follow a Dim statement with a Replace() function.

  6. #6
    Join Date
    Mar 2009
    Posts
    12
    I'm still wondering why you follow a Dim statement with a Replace() function. ...
    I have posted NOT full code, only Error relevant part...

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums