G
Guest
I have following code that enters the dates into calendar form.I need to
filter some records.I’m aware that I can do it though strSQL but I would
rather filter them.I'm going to need filtered records for a listbox.I'm just
testing it on the calendar to see if it would return only filtered
records.Well, my problem is that it doesn't return filtered records, it
returns all of them. Here is the code:
Dim rcd As ADODB.Recordset, strSQL As String, rcd1 As ADODB.Recordset
Dim cn As ADODB.Connection, strWhat As String
Me!ActiveXCal = Date
strWhat = "Court App." 'Filter
Set cn = CurrentProject.Connection
Set rcd = New ADODB.Recordset
strSQL = " SELECT qvyApp.id,qvyApp.remtime,qvyApp.remETime,qvyApp.Cname, " & _
" qvyApp.remWhat,qvyApp.Applic FROM qvyApp WHERE (qvyApp.remDate) =
date()"
strSQL = strSQL & " ORDER BY remtime"
rcd.Open strSQL, cn
rcd.Filter = "[RemWhat] = '" & strWhat & "'" 'Apply Filter
If rcd.EOF Then
cn.Close
rcd.Close
Set rcd = Nothing
Set cn = Nothing
Exit Sub
Else
Do While Not rcd.EOF
'Enter App. into Calendar
On Error Resume Next
Calendar1.AddAppointment rcd!remtime, rcd!remEtime, rcd!remWhat & ": " &
rcd!CName & " " & rcd!Applic, rcd!ID
rcd.MoveNext
Loop
cn.Close
rcd.Close
Set rcd = Nothing
Set cn = Nothing
end sub
What am I missing?
Thanks in advance
Armin
filter some records.I’m aware that I can do it though strSQL but I would
rather filter them.I'm going to need filtered records for a listbox.I'm just
testing it on the calendar to see if it would return only filtered
records.Well, my problem is that it doesn't return filtered records, it
returns all of them. Here is the code:
Dim rcd As ADODB.Recordset, strSQL As String, rcd1 As ADODB.Recordset
Dim cn As ADODB.Connection, strWhat As String
Me!ActiveXCal = Date
strWhat = "Court App." 'Filter
Set cn = CurrentProject.Connection
Set rcd = New ADODB.Recordset
strSQL = " SELECT qvyApp.id,qvyApp.remtime,qvyApp.remETime,qvyApp.Cname, " & _
" qvyApp.remWhat,qvyApp.Applic FROM qvyApp WHERE (qvyApp.remDate) =
date()"
strSQL = strSQL & " ORDER BY remtime"
rcd.Open strSQL, cn
rcd.Filter = "[RemWhat] = '" & strWhat & "'" 'Apply Filter
If rcd.EOF Then
cn.Close
rcd.Close
Set rcd = Nothing
Set cn = Nothing
Exit Sub
Else
Do While Not rcd.EOF
'Enter App. into Calendar
On Error Resume Next
Calendar1.AddAppointment rcd!remtime, rcd!remEtime, rcd!remWhat & ": " &
rcd!CName & " " & rcd!Applic, rcd!ID
rcd.MoveNext
Loop
cn.Close
rcd.Close
Set rcd = Nothing
Set cn = Nothing
end sub
What am I missing?
Thanks in advance
Armin