Results 1 to 4 of 4

Thread: syntax

  1. #1
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Dear Loungers,

    I do get easily confused... I'm writing a report I have a field that works like this: [PersonName] &" - "& [PER_Id], but what a really want is something that results in Fred Bloggs (1234), however if I do this it works
    • [PersonName] &" ( "& [PER_Id] but as soon as I try to concatenate a close bracket like this
      [PersonName] &" ( "& [PER_Id] & ")"

    access complain's there is a syntax error, the error reports the resolved code to be this: 'First([[PersonName]&" ("& [PER_ID] &")"])'.

    Why does the addition of another ampersand not work? and how can I correct this?

    thank you....................... liz

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    Quote Originally Posted by lizat View Post
    Dear Loungers,

    I do get easily confused... I'm writing a report I have a field that works like this: [PersonName] &" - "& [PER_Id], but what a really want is something that results in Fred Bloggs (1234), however if I do this it works
    • [PersonName] &" ( "& [PER_Id] but as soon as I try to concatenate a close bracket like this
      [PersonName] &" ( "& [PER_Id] & ")"

    access complain's there is a syntax error, the error reports the resolved code to be this: 'First([[PersonName]&" ("& [PER_ID] &")"])'.

    Why does the addition of another ampersand not work? and how can I correct this?

    thank you....................... liz
    Instead of [PersonName] &" ( "& [PER_Id] & ")"
    try
    [PersonName] & " ( " & [PER_Id] & ")"

    There must always be a space between the " and &.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Quote Originally Posted by lizat View Post
    access complain's there is a syntax error, the error reports the resolved code to be this: 'First([[PersonName]&" ("& [PER_ID] &")"])'.
    In case Patt's suggestion did not solve the problem, can you explain where the "First" in the above quote comes from. You have not mentioned it earlier in the post.
    Regards
    John



  4. #4
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Patt, Ok it worked perfectly, thank you!

    John, Actually I don't know why First is there I ddn'y consciously do that so I am mystified?

    liz

Posting Permissions

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