Duane
Sent from my mobile
On Jul 17, 2020, at 5:35 PM, Arnelito Puzon <agpuzon@gmail.com> wrote:
You do not NEED to change the Query everytime, especially if other reports is based on it.What you need is to Filter the Report when you Open it:
Private Sub OK_Click()Dim strSQL As String'no need to change the Query SQL'Dim strOldSQL As StringIf Not IsNull(Me.txtStart) ThenstrSQL = strSQL & "MaxOfReleaseDate >= #" & Format(Me.txtStart, "mm\/dd\/yyyy") & "# AND "End IfIf Not IsNull(Me.txtEnd) ThenstrSQL = strSQL & "MaxOfReleaseDate <= #" & Format(Me.txtEnd, "mm\/dd\/yyyy") & "# AND "End IfIf Not IsNull(Me.cbQRFType) ThenstrSQL = strSQL & "QRFTypeDescr = '" & Me.cbQRFType & "' AND "End IfIf Not IsNull(Me.txtClassCode) ThenstrSQL = strSQL & "[Class] = '" & Me.txtClassCode & "' AND "End IfIf Len(strSQL) > 0 ThenstrSQL = Trim(Left(strSQL, Len(strSQL) - 5))End If' On the Report, you Add the Sort Order on it's Property'strSQL = strSQL & "ORDER BY [SN/LotStart], WorkOrderNo;"' you DO NOT NEED to change the query,' use strSQL to FILTER the report'strOldSQL = fChangeSQL("Instruments Query", strSQL)DoCmd.OpenReport ReportName:="Instruments Detail Report", view:=acViewPreview, WhereCondition:=strSQLEnd Sub
--
Arnelito G. Puzon
Tidak ada komentar:
Posting Komentar