Results 1 to 2 of 2

Thread: SQL with quotes problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113

    Angry

    Hi, this is my first posting on this site.

    In VB 5 I am having a problem making an SQL query. I need to have quotes in the query but VB says there is a problem.
    here is the query...

    SELECT prCustomers.Num, prCustomers.Type, IIf([prCustomers]![Type] = "c",[name],"err") AS Cop, IIf([prCustomers]![Type]="i",[surname],"err") AS Ind" & _
    "FROM (prCustomers LEFT JOIN prCorporate ON prCustomers.Num = prCorporate.num) LEFT JOIN prIndividual ON prCustomers.Num = prIndividual.Num"

    What I need to know is how do I have the "c" without VB thinking that I am closing the string. The same with when I need a string "err" put in the query. VB gets to the first " and thinks I am closing the string.

    Thanks
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If you wanted to make a variable with contents:

    My house is called "Thornby"

    then you would use this syntax:

    sMyStr = "My house is called ""Thornby"""

    You need to 'escape' the quotes. Simply put two quotes, and they will appear as one.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

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



Click Here to Expand Forum to Full Width