Results 1 to 2 of 2

Thread: SQL Select format !

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Littlehampton, W Sussex GB
    Posts
    203

    Post

    Thanks for your help with the last question ScottF.
    I have a new problem now - I want to populate my 'recordsource' at runtime with a select statement. I have a Customer Id in strCustID and am doing the following.
    strSource = "select * from Contacts where [Customer ID] = strCustID"
    Then I'm putting strSource into the recordsource of my data control
    I've got something wrong here but am not sure what as my control is not pointing to the correct Cust Id, but it is correct in strCustID. Can anyone help? Thanks.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    According to naming convention your variable strCustID is a string, then change you SQL statement to:

    strSource = "Select * From Contacts Where[Customer ID] = '" & strCustID & "'"



    If strCustID is a numeric type then change you SQL statement to:

    strSource = "Select * From Contacts Where[Customer ID] = " & strCustID


    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]




    [This message has been edited by Serge (edited 08-03-1999).]

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