Results 1 to 6 of 6

Thread: variables in SQL

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    88

    Post

    does anyone know the proper syntax to insert variables into an SQL statement? the references i have and the vb help files do not seem to cover this.

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    is this in MS Access?

  3. #3
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    For sample:
    "select * from table where numfield = " & number
    "select * from table where txtfield = '" & text & "'"

    ------------------
    smalig
    [email protected]
    smalig.tripod.com

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    88

    Post

    this will be in vb. i attempted to use a select statement very similar to what smalig suggested but things don't seem to be working properly. i've pretty much decided to cry uncle and purchased sql for dummies over the weekend.

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    smalig's code looks right. You could post your code and we'll take a look....

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    88

    Post

    i actually just figured out the problem. i kept getting a message concerning incompatible data types. after i went off in several different directions, i realized that i was not using quotes. sometimes it's in the details.

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