Consulting

Results 1 to 3 of 3

Thread: including string in string

  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Posts
    27
    Location

    including string in string

    sql:
    contract="new"

    i want to use it in sql string
    vba:

    sqlstring = ""
    sqlstring =sqlstring&"contact="new""

    This does not not work
    how can I include string in string?
    Thanks.

  2. #2
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Hey jeff,

    When you use quotes inside string values, you have to place two quotation marks "" to signify a single quotation (") inside the string.

    And shouldn't you use apostrophes ' for SQL strings?

    [vba]sqlString = "" ' No text at all
    sqlString = sqlString & "contract = ""new""" ' No text plus 'contract = "new"'[/vba]




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  3. #3
    VBAX Regular
    Joined
    Jun 2007
    Posts
    27
    Location
    Thanks

Posting Permissions

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