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
    SSQL = "SELECT PROVA2,PROVA1,PROVA3,PROVA9,PROVA11,PROVA15,PROVA1 7,PROVA13,PROVA14,PROVA18 FROM DATI WHERE PROVA19 = '" & Left(Me.COMBO_DISTRETTO.Text, 8) & "' AND PROVA2 = '" & Mid(Me.COMBO_SPORTELLO, 10, 4) & "' AND PROVA18 BETWEEN " & DA_GG_G & " AND " & A_GG_G & " AND PROVA3 ='" & Me.COMBO_SETTORE & "' AND PROVA14 BETWEEN " & IMPDA & " AND " & IMPA & " AND LEFT(PROVA22,2)='SI' ORDER BY INT(PROVA2)"

    i have this sql and i want to insert a condition IF in internal of string select...

    if my var="AA"

    AND PROVA13 BETWEEN " & IMPDA & " AND " & IMPA & "

    if my var="AB"

    AND PROVA14 BETWEEN " & IMPDA & " AND " & IMPA & "

    if my var="AC"

    AND PROVA15 BETWEEN " & IMPDA & " AND " & IMPA & "

    possible????

  2. #2
    5 Star Lounger
    Join Date
    Apr 2003
    Location
    Hampshire, United Kingdom
    Posts
    602
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='sal21' post='771710' date='22-Apr-2009 11:51']SSQL = "SELECT PROVA2,PROVA1,PROVA3,PROVA9,PROVA11,PROVA15,PROVA1 7,PROVA13,PROVA14,PROVA18 FROM DATI WHERE PROVA19 = '" & Left(Me.COMBO_DISTRETTO.Text, 8) & "' AND PROVA2 = '" & Mid(Me.COMBO_SPORTELLO, 10, 4) & "' AND PROVA18 BETWEEN " & DA_GG_G & " AND " & A_GG_G & " AND PROVA3 ='" & Me.COMBO_SETTORE & "' AND PROVA14 BETWEEN " & IMPDA & " AND " & IMPA & " AND LEFT(PROVA22,2)='SI' ORDER BY INT(PROVA2)"

    i have this sql and i want to insert a condition IF in internal of string select...

    if my var="AA"

    AND PROVA13 BETWEEN " & IMPDA & " AND " & IMPA & "

    if my var="AB"

    AND PROVA14 BETWEEN " & IMPDA & " AND " & IMPA & "

    if my var="AC"

    AND PROVA15 BETWEEN " & IMPDA & " AND " & IMPA & "

    possible????[/quote]
    [codebox]SSQL = "SELECT PROVA2,PROVA1,PROVA3,PROVA9,PROVA11,PROVA15,PROVA1 7,PROVA13,PROVA14,PROVA18 FROM DATI WHERE PROVA19 = '" & Left(Me.COMBO_DISTRETTO.Text, 8) & "' AND PROVA2 = '" & Mid(Me.COMBO_SPORTELLO, 10, 4) & "' AND PROVA18 BETWEEN " & DA_GG_G & " AND " & A_GG_G & " AND PROVA3 ='" & Me.COMBO_SETTORE & "' AND "
    Select Case myVar
    Case "AA":
    SSQL = SSQL & "PROVA13"
    Case "AB":
    SSQL = SSQL & "PROVA14"
    Case "AC":
    SSQL = SSQL & "PROVA15"
    End Select
    SSQL = SSQL & " BETWEEN " & IMPDA & " AND " & IMPA & " AND LEFT(PROVA22,2)='SI' ORDER BY INT(PROVA2)" [/codebox]
    Waggers
    If at first you do succeed, you've probably missed something.

Posting Permissions

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