Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    157

    Unanswered: Prompt to enter date again

    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;

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    What is the exact message?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Sample Report

    Here's a sample reporting system. I'm guessing if you're getting prompted for a date again, it's either not defined with the same name, you're referencing the field verses the value (i.e. me.mydate verses me!mydate) or it can't find it in the report.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •