Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why error in sql:

    i have set the filed in PROVA18 Number
    .......
    Dim DA_GG_G As Long, A_GG_G As Long
    DA_GG_G = (Me.DA_GIORNI.Text) * 1
    A_GG_G = (Me.A_GIORNI.Text) * 1

    strSQL1 = "SELECT * FROM DATI WHERE PROVA19 = '" & Left(Me.COMBO_DISTRETTO.Text, 8) & "' AND WHERE PROVA18 > '" & DA_GG_G & "' AND PROVA18 < '" & A_GG_G & "' ORDER BY PROVA2,PROVA3 ASC"
    Set RSSQLD = CNSQL.Execute(strSQL1)
    ......

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='sal21' post='767134' date='24-Mar-2009 23:18'][/quote]
    If PROVA18, DA_GG_G and A_GG_G are Numeric they don't need to be surrounded by quotes.
    Use :
    Code:
    strSQL1 = "SELECT * FROM DATI WHERE PROVA19 = '" & Left(Me.COMBO_DISTRETTO.Text, 8) & "'  AND WHERE PROVA18 >  " & DA_GG_G & "   AND PROVA18 <  " & A_GG_G & "  ORDER BY PROVA2,PROVA3 ASC"
    Francois

Posting Permissions

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