Sql Variable In Vb6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stupot1987
    New Member
    • Jun 2007
    • 8

    Sql Variable In Vb6

    guys any ideas on comparing these varialbe strings in vb6?

    Code:
    Private Sub Command1_Click()
    Exit Sub
    Adodc1.RecordSource = "SELECT Stock.[Product Code], Stock.Description, Stock.[Quantity in Stock], Stock.[Re Order Level] FROM Stock; 
    WHERE Stock.[Quantity in Stock]) < Stock.[Re Order Level];"
    Adodc1.Recordset.Requery
    Adodc1.Refresh
    DataGrid1.Refresh
    End Sub
    thnx in advance :)
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    can u please post what exactly is your problem.

    remove the ";" before where clause in the query.

    Comment

    • stupot1987
      New Member
      • Jun 2007
      • 8

      #3
      Ok in reference to my code above in the where clause i want to compare a field with another to display only the records where the quantity of the stock field is less than the re order field.

      iv removed the ; after the FROM section but stil when the command button is pressed nothin happens!

      any suggestions?

      Comment

      • mattkorguk
        New Member
        • Mar 2007
        • 28

        #4
        Did you try removing the ";" from BEFORE the WHERE section...

        Comment

        • pureenhanoi
          New Member
          • Mar 2007
          • 175

          #5
          Originally posted by stupot1987
          guys any ideas on comparing these varialbe strings in vb6?

          Code:
          Private Sub Command1_Click()
          Exit Sub
          Adodc1.RecordSource = "SELECT Stock.[Product Code], Stock.Description, Stock.[Quantity in Stock], Stock.[Re Order Level] FROM Stock; 
          WHERE Stock.[Quantity in Stock]) < Stock.[Re Order Level];"
          Adodc1.Recordset.Requery
          Adodc1.Refresh
          DataGrid1.Refresh
          End Sub
          thnx in advance :)
          See in ur code. Line 2 with a statement: "Exit Sub" will make this Sub do nothing. Remove it. Try ur code again and tell me if still have problem

          Comment

          • stupot1987
            New Member
            • Jun 2007
            • 8

            #6
            cheers guys! pure genius! that or stupidity on my part :P the exit sub was the problem nice one mate much appreciated! any ideas how to do is less than or equal to tho? doesnt seem to be excepting =< in there :S

            Comment

            • stupot1987
              New Member
              • Jun 2007
              • 8

              #7
              no worries guys iv sorted that prob u have to put <= not =< thnx alot guys im very thankful for your help :)

              Comment

              Working...