icemonster
Registered User.
- Local time
- Yesterday, 23:13
- Joined
- Jan 30, 2010
- Messages
- 502
hello, i posted this on another part of this forum and sorry if am doing it again. but i really cannot figure out how to send the criteria of this vba to my report. any ideas is greatly appreciated. pbadly told me something bout removing the where but it doesnt seem to work.
this is the sql statement for the listbox with the underlying filters, what i want is, to send the result of this sql to the report.
but somehow, when i did what pbaldy told me, i did it like this:
it doesnt work.
this is the sql statement for the listbox with the underlying filters, what i want is, to send the result of this sql to the report.
Code:
Function setVisitDueList()
'set starting sql statement
strStartSql2 = "SELECT qryVisitListVBA2.ID, qryVisitListVBA2.SupervisoryVisitID, qryVisitListVBA2.[Homemaker Name], " _
& "qryVisitListVBA2.HireDate, qryVisitListVBA2.InitialVisit, qryVisitListVBA2.SupervisoryVisitDate, " _
& "qryVisitListVBA2.ClientID, qryVisitListVBA2.TypeofHomemaker1, qryVisitListVBA2.TypeofHomemaker, " _
& "qryVisitListVBA2.NextVisitOn, qryVisitListVBA2.VisitDate, qryVisitListVBA2.supervisor FROM qryVisitListVBA2 "
If Not IsNull(Me.txtSearch2) Then
strWhereSql2 = "WHERE qryVisitListVBA2.[Homemaker Name] Like '*" & Me.txtSearch2 & "*'"
Else
strWhereSql2 = ""
End If
If Not IsNull(Me.txtStartDate2) And Not IsNull(Me.txtEndDate2) Then
'read the dates selected in the variables
dtStartDate2 = Me.txtStartDate2
dtEndDate2 = Me.txtEndDate2
If strWhereSql2 = "" Then
strWhereSql2 = " WHERE VisitDate Between #" & dtStartDate2 & "# " _
& "And #" & dtEndDate2 & "# "
Else
strWhereSql2 = strWhereSql2 & "AND VisitDate Between #" & dtStartDate2 & "# " _
& "And #" & dtEndDate2 & "# "
End If
End If
strSortOrderSql2 = " ORDER BY qryVisitListVBA2.VisitDate;"
strSQL2 = strStartSql2 & strWhereSql2 & strSortOrderSql2
With Me.lstSupervisoryVisit
.RowSource = strSQL2
.Value = Null
End With
End Function
but somehow, when i did what pbaldy told me, i did it like this:
Code:
DoCmd.OpenReport "rptReport", acPreview, , SDate = strWhereSql2
it doesnt work.