Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Manchester, Gtr Manchester, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL strings with '' (2000)

    I am unable to modify the following statement to include a space between [FirstName] and [LastName]

    strSQL = "INSERT INTO tlkpMembersAvailable (MemberID, MemberName) SELECT [MemberID], [FirstName] & [LastName] AS MemberName FROM tblMembers;"

    (which is then run by) DoCmd.RunSQL strSQL

    It's not for want of trying, I just can't figure out where to stick the extra quotes without ruining the syntax of the string.

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

    Re: SQL strings with '' (2000)

    Hi Darsha, you can use

    <code>[FirstName] & ' ' & [LastName] AS MemberName</code>

    I used single quotes around the space because you already use double quotes to delimit strSQL. As an alternative, you could use double double quotes

    <code>[FirstName] & "" "" & [LastName] AS MemberName</code>

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Manchester, Gtr Manchester, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL strings with '' (2000)

    That's it, I think I'd tried everthing but! Thanks for the prompt reply <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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