icemonster
Registered User.
- Local time
- Yesterday, 20:27
- Joined
- Jan 30, 2010
- Messages
- 502
hello,
here is my code for a form''s list box,
now, someone told me back then, i can also use the criteria here to open a report, how do i do that? do i use a set link? please help. thanks.
here is my code for a form''s list box,
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.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
now, someone told me back then, i can also use the criteria here to open a report, how do i do that? do i use a set link? please help. thanks.