A
Anna
Hi:
When i run my report it ask me a prompt to Enter Date, I already enter
date from the parameter form, I dont know why it ask
me to enter date. The date variable is in the query but i didnt define
into the report
Private Sub cmd_prntrpt_Click()
On Error GoTo Err_cmd_prntrpt_Click
If IsNull(Me.ddlcrc) = False Then
WCriteria = "[crc] = '" & Me.ddlcrc & "'"
End If
If IsNull(Me.ddlwm_desc) = False Then
If Len(WCriteria) > 0 Then
WCriteria = WCriteria & " AND [wm_desc] = '" & Me.ddlwm_desc &
"'"
Else
WCriteria = "[wm_desc] = '" & Me.ddlwm_desc & "'"
End If
End If
If IsNull(Me.txtDate1) = False And IsNull(Me.txtDate2) = False Then
If Len(WCriteria) > 0 Then
WCriteria = WCriteria & " AND ([WM_Date] BETWEEN #" & _
Me.txtDate1 & "# AND #" & Me.txtDate2 &
"#)"
Else
WCriteria = "[WM_Date] BETWEEN #" & _
Me.txtDate1 & "# AND #" & Me.txtDate2 & "#"
End If
Else
If IsNull(Me.txtDate1) = False Then
If Len(WCriteria > 0) Then
WCriteria = WCriteria & " AND [WM_Date] = #" & Me.txtDate1 &
"#"
Else
WCriteria = "[WM_Date] = #" & Me.txtDate1 & "#"
End If
ElseIf IsNull(Me.txtDate2) = False Then
If Len(WCriteria > 0) Then
WCriteria = WCriteria & " AND [WM_Date] = #" & Me.txtDate2 &
"#"
Else
WCriteria = "[WM_Date] = #" & Me.txtDate2 & "#"
End If
End If
End If
Dim stDocName As String
DoCmd.OpenReport "rpt_qrywebmail2", acPreview, , WCriteria
Forms!frmWeb_Mailfilter.Visible = False
Exit_cmd_prntrpt_Click:
Exit Sub
Err_cmd_prntrpt_Click:
MsgBox Err.Description
Resume Exit_cmd_prntrpt_Click
End Sub
QUERY
-----
SELECT tbl_WebMail.CRC, Sum(tbl_WebMail.WM_Amt) AS Totamnt
FROM tbl_WebMail
WHERE (((tbl_WebMail.WM_Date) Between
[Forms]![frmWeb_Mailfilter]![txtdate1] And
[Forms]![frmWeb_Mailfilter]![txtdate2]))
GROUP BY tbl_WebMail.CRC;
When i run my report it ask me a prompt to Enter Date, I already enter
date from the parameter form, I dont know why it ask
me to enter date. The date variable is in the query but i didnt define
into the report
Private Sub cmd_prntrpt_Click()
On Error GoTo Err_cmd_prntrpt_Click
If IsNull(Me.ddlcrc) = False Then
WCriteria = "[crc] = '" & Me.ddlcrc & "'"
End If
If IsNull(Me.ddlwm_desc) = False Then
If Len(WCriteria) > 0 Then
WCriteria = WCriteria & " AND [wm_desc] = '" & Me.ddlwm_desc &
"'"
Else
WCriteria = "[wm_desc] = '" & Me.ddlwm_desc & "'"
End If
End If
If IsNull(Me.txtDate1) = False And IsNull(Me.txtDate2) = False Then
If Len(WCriteria) > 0 Then
WCriteria = WCriteria & " AND ([WM_Date] BETWEEN #" & _
Me.txtDate1 & "# AND #" & Me.txtDate2 &
"#)"
Else
WCriteria = "[WM_Date] BETWEEN #" & _
Me.txtDate1 & "# AND #" & Me.txtDate2 & "#"
End If
Else
If IsNull(Me.txtDate1) = False Then
If Len(WCriteria > 0) Then
WCriteria = WCriteria & " AND [WM_Date] = #" & Me.txtDate1 &
"#"
Else
WCriteria = "[WM_Date] = #" & Me.txtDate1 & "#"
End If
ElseIf IsNull(Me.txtDate2) = False Then
If Len(WCriteria > 0) Then
WCriteria = WCriteria & " AND [WM_Date] = #" & Me.txtDate2 &
"#"
Else
WCriteria = "[WM_Date] = #" & Me.txtDate2 & "#"
End If
End If
End If
Dim stDocName As String
DoCmd.OpenReport "rpt_qrywebmail2", acPreview, , WCriteria
Forms!frmWeb_Mailfilter.Visible = False
Exit_cmd_prntrpt_Click:
Exit Sub
Err_cmd_prntrpt_Click:
MsgBox Err.Description
Resume Exit_cmd_prntrpt_Click
End Sub
QUERY
-----
SELECT tbl_WebMail.CRC, Sum(tbl_WebMail.WM_Amt) AS Totamnt
FROM tbl_WebMail
WHERE (((tbl_WebMail.WM_Date) Between
[Forms]![frmWeb_Mailfilter]![txtdate1] And
[Forms]![frmWeb_Mailfilter]![txtdate2]))
GROUP BY tbl_WebMail.CRC;