HI
I am passing a variable Byref, but when return It is not changed
STR_ANO_INICIO is constant inside query,when return procedure It already is with STR_ANO_INICIO"Code:Private Sub VerFiltroData(ByRef SSql As String) Dim AnosInicio As String Dim lSql As String Dim i As Integer '-----------------------------------------' ' Veririca Quais Anos Estão clicados ' '-----------------------------------------' For i = 0 To lbxAnoInicio.ListCount - 1 If lbxAnoInicio.Selected(i) Then If AnosInicio <> "" Then AnosInicio = AnosInicio + ", " AnosInicio = AnosInicio + lbxAnoInicio.List(i) End If Next i '----------------------------' ' Montaquery com anos '----------------------------' lSql = "" If AnosInicio <> "" And AnosInicio <> "<Todas>" Then lSql = lSql & " and to_number(to_char(A.DATA_INICIO,'YYYY')) in (" & AnosInicio & ")" & vbCrLf End If SSql = Replace(SSql, "STR_ANO_INICIO", lSql) End Sub




Reply With Quote