• SQL strings with ” (2000)

    Author
    Topic
    #409113

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #869434

      Hi Darsha, you can use

      [FirstName] & ' ' & [LastName] AS MemberName

      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

      [FirstName] & "" "" & [LastName] AS MemberName

      • #869448

        That’s it, I think I’d tried everthing but! Thanks for the prompt reply cheers

      • #869449

        That’s it, I think I’d tried everthing but! Thanks for the prompt reply cheers

    • #869435

      Hi Darsha, you can use

      [FirstName] & ' ' & [LastName] AS MemberName

      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

      [FirstName] & "" "" & [LastName] AS MemberName

    Viewing 1 reply thread
    Reply To: SQL strings with ” (2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: