Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sydney, Australia, New South Wales, Australia
    Posts
    251
    Thanks
    0
    Thanked 4 Times in 4 Posts
    I'm using Eval to work with some tricky code.
    Looks to me like Eval doesn't understand vb constants, but I can't find anything about it on MS site or elsewhere. Has anyone have any insight on this?
    Thanks
    Peter

    [codebox]
    ? eval(" ""ab"" & ""cd"" ")
    abcd

    ? eval(" ""ab"" & chr(13) & ""cd"" ")
    ab
    cd

    ? eval(" ""ab"" & vbCrlf & ""cd"" ")
    'Throws error
    [/codebox]

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Eval is an Access VBA function that can be used in expressions in queries and in the control source of controls on forms and reports.
    You can use VBA functions in expressions, but not symbolic VBA constants. So for example if you want to include a line break in the control source of a text box, you can use

    =Trim([Address]) & Chr(13) & Chr(10) & [City]

    but *not*

    =Trim([Address]) & vbCrLf & [City]

Posting Permissions

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