CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    13

    passing value from text box to SQL

    I'm using VB6 and an Access database. I have two text boxes. I want the user to be able to enter a low monetary amount in one text box and a high one in the other, and then pass these values to a recordset's SQL statement, as in ..."WHERE x BETWEEN '600' AND '900'. I can't use variables to pass these values to the SQL statement because Access can't read the variables. Is there any way of doing this? Any help is appreciated.


  2. #2
    Join Date
    May 1999
    Posts
    14

    Re: passing value from text box to SQL

    Hi John:

    I hope the other things worked for you. For var's in SQL, do it like this:

    strSQL="SELECT ### FROM ### WHERE TABLE.FIELD > " & varName & " AND < " & anotherVarName

    Don't forget to put the spaces at the start or end of the strings so your statment does not run together.




  3. #3
    Join Date
    May 1999
    Posts
    14

    Re: SQL Post Correction

    Correction:

    strSQL="SELECT ### FROM ### WHERE TABLE.FIELD > " & varName & " AND TABLE.FIELD < " & anotherVarName

    Sorry.



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

Featured