troubleshooting Question

Prompt to enter value again

Avatar of mustish1
mustish1 asked on
Microsoft Access
21 Comments1 Solution259 ViewsLast Modified:
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;
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 21 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros