Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Jan 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Left() error (2000)

    Hi All,

    I have a weird one here: when I try to get the result of left("Hello", 3) I would normally expect to get "Hel" as the result. Instead I am getting a Compile Error: Expected Array.

    I have never had this issue before... do I need to reference anything? I would have thought this was a basic function, and the len() function works ok... any suggestions?

    Thanks
    JB

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Left() error (2000)

    I suspect the problem is the part of the expression you left out. strSomething = Left("Hello",3) should work. Left("Hello",3) = something won't, because it looks like you're trying to populate the 4th dimension of an array called Left().
    Charlotte

  3. #3
    New Lounger
    Join Date
    Jan 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Left() error (2000)

    Hi Charlotte,

    sorry, I should have been more specific - I do have something like strText = left("Hello", 3) when I am getting the error.

    thanks
    JB

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Left() error (2000)

    If you're getting a compile error, what line is it erroring on? Can you type the expression ? left("Hello", 3) into the immediate window and have it return the expected value?
    Charlotte

  5. #5
    New Lounger
    Join Date
    Jan 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Left() error (2000)

    Hi Charlotte,

    Yes, I have tried this, and still get the compile error.... it highlights the word 'Left' after hitting ok to the error message.

    JB

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Left() error (2000)

    Then check your references. Something appears to be broken or missing.
    Charlotte

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Left() error (2000)

    To expand on Charlotte's answer: in the Visual Basic Editor, select Tools | References...
    If there are any references starting with MISSING, write down which ones they are, then clear their check boxes and click OK.
    Try Debug | Compile <project name> to see if you get syntax errors now. If not, the problem is solved (hopefully). If Access complains about unknown user-defined types, one of the references you wrote down was essential. You'll have to add it again, but with the correct location this time. This may take some searching.

  8. #8
    New Lounger
    Join Date
    Jan 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Left() error (2000)

    Thanks - there were no missing references.
    However, when I removed the MS Flexgrid control from the references (as I no longer needed it), it fixed the problem!!

    Thanks
    JB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •