Guest_imported
New member
- Jan 1, 1970
- 0
This is my code:
'Event open report
Private Sub Report_Open(Cancel As Integer)
Dim Frm As String
Dim FldDATE As String
Frm = "FormName"
FldDATE = "[DATE]"
'Run on Windows2000. This code used to filter data
Me.ServerFilter = getPrintFilter(Frm, FldDATE)
Me.FilterOn = True
End Sub
'Function Filter
Public Function getPrintFilter(Frm As String, FldDATE As String) As String
On Error Resume Next
Dim strFilter As String
'Filter Program
If (Not (IsNull(Forms(Frm)!txtFrmID))) Then
strFilter = "[IP_ID]=" + CStr(Nz(Forms(Frm)!FrmID, "0") + " AND "
End If
'Filter From date
If (Not (IsNull(Forms(Frm)!TxtFROM))) Then
strFilter = strFilter + FldDATE + ">=" + CStr(Nz(Forms(Frm)!TxtFROM, "") + " AND "
End If
'Filter To date
If (Not (IsNull(Forms(Frm)!txtTO))) Then
strFilter = strFilter + FldDATE + "<=" + CStr(Nz(Forms(Frm)!txtTO, "") + " AND "
End If
If (Len(strFilter) >= 5) Then
strFilter = Left(strFilter, Len(strFilter) - 5)
End If
getPrintFilter = strFilter
Exit_Func:
Exit Function
Err_Func:
ShowErr (Err.Description)
Resume Exit_Func
End Function
I don't know why it run on WindowsXP ,but it not run on Window2000 Professional. Pls help me .....
'Event open report
Private Sub Report_Open(Cancel As Integer)
Dim Frm As String
Dim FldDATE As String
Frm = "FormName"
FldDATE = "[DATE]"
'Run on Windows2000. This code used to filter data
Me.ServerFilter = getPrintFilter(Frm, FldDATE)
Me.FilterOn = True
End Sub
'Function Filter
Public Function getPrintFilter(Frm As String, FldDATE As String) As String
On Error Resume Next
Dim strFilter As String
'Filter Program
If (Not (IsNull(Forms(Frm)!txtFrmID))) Then
strFilter = "[IP_ID]=" + CStr(Nz(Forms(Frm)!FrmID, "0") + " AND "
End If
'Filter From date
If (Not (IsNull(Forms(Frm)!TxtFROM))) Then
strFilter = strFilter + FldDATE + ">=" + CStr(Nz(Forms(Frm)!TxtFROM, "") + " AND "
End If
'Filter To date
If (Not (IsNull(Forms(Frm)!txtTO))) Then
strFilter = strFilter + FldDATE + "<=" + CStr(Nz(Forms(Frm)!txtTO, "") + " AND "
End If
If (Len(strFilter) >= 5) Then
strFilter = Left(strFilter, Len(strFilter) - 5)
End If
getPrintFilter = strFilter
Exit_Func:
Exit Function
Err_Func:
ShowErr (Err.Description)
Resume Exit_Func
End Function
I don't know why it run on WindowsXP ,but it not run on Window2000 Professional. Pls help me .....