edgarchado
Technical User
Hi to all,
I have found in the web a microsoft example how to filter a report using combo boxes in a form.
I have found it to be really usefull for what I need to do.
The problem is that I ma having trouble with the data type.
Here is the code for the filter command button:
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 2
If Me("Filter" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " _
& " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & _
" And "
End If
Next
If strSQL <> "" Then
' Strip Last " And ".
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![infReporte_Pedidos].Filter = strSQL
Reports![infReporte_Pedidos].FilterOn = True
End If
End Sub
The problem is that I am trying to filter using a date and an autonumber. The data type for the date in my table is DATA and the data type for the number is autonumber.
If I change the datatype of the date to char I have no problem when filtering. On the other hand I can not seem to find the problem with the number. I would like to leave the datatypes as i intended originally. Is there a way to put something in the code so i dont have to change the data types?
Thanks and i hope i am clear enough.
I have found in the web a microsoft example how to filter a report using combo boxes in a form.
I have found it to be really usefull for what I need to do.
The problem is that I ma having trouble with the data type.
Here is the code for the filter command button:
Private Sub Set_Filter_Click()
Dim strSQL As String, intCounter As Integer
' Build SQL String.
For intCounter = 1 To 2
If Me("Filter" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " _
& " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & _
" And "
End If
Next
If strSQL <> "" Then
' Strip Last " And ".
strSQL = Left(strSQL, (Len(strSQL) - 5))
' Set the Filter property.
Reports![infReporte_Pedidos].Filter = strSQL
Reports![infReporte_Pedidos].FilterOn = True
End If
End Sub
The problem is that I am trying to filter using a date and an autonumber. The data type for the date in my table is DATA and the data type for the number is autonumber.
If I change the datatype of the date to char I have no problem when filtering. On the other hand I can not seem to find the problem with the number. I would like to leave the datatypes as i intended originally. Is there a way to put something in the code so i dont have to change the data types?
Thanks and i hope i am clear enough.