how do i make a report to just show between two dates?

  • Thread starter Thread starter jacqui
  • Start date Start date
J

jacqui

Guest
how to i build a report to show information between two dates?
 
Your report should be based on a query. In the criteria of the date part of your query add: Between [Enter Start Date] and [Enter Finish date]

You will be prompted for the dates when you run your report.

Sorry, didn't see the previous reply by DavidR. Keep to the same post please Jacqui.

[This message has been edited by saintsman (edited 03-20-2002).]
 
i have set this criteria, but it will only report for one date how can i expand this to show a whole month?
 
Here is a example of doing it with code using two text boxes and a command button.

Code:
Private Sub cmdSelect_Click()

    ' Create two text boxes on your form, one named txtBeginDate
    ' and the other one txtEndDate
  
    Dim bProcOk As Boolean
    bProcOk = True
  
    ' The following IF Then series checks for null values in
    ' the stated txtbox. If a null is found the error message
    ' is displayed and the focus is sent back to form control
      
    If IsNull(Me.txtBeginDate) Then
        MsgBox "You must provide a beginning date!", vbExclamation, "Error"
        txtBeginDate.SetFocus
        bProcOk = False
    Else
        If IsNull(Me.txtEndDate) Then
            MsgBox "You must provide a ending date!", vbExclamation, "Error"
            txtEndDate.SetFocus
            bProcOk = False
        End If
    End If
    
    If bProcOk Then ' If the above IF Thens are satisfied
    ' the following command is carried out
      
    DoCmd.OpenReport "EmpContactLog", acPreview, , _
    "[date]>=#" & Me![txtBeginDate] & "# And [date]<= #" & _
    Me![txtEndDate] & "#"
    
    ' Opens the report based on the begin and end date
    
 End If

End Sub

This will show all records that fall between the two dates entered in each box.

[This message has been edited by BukHix (edited 03-20-2002).]
 
You can also set your parameter(s) to enter the month and select data with Month([DateField]). Or make an unbound form to choose a month/year from a combo box. Or use a calendar control.

Good luck,
David R
 
Syntax error

The original post was exactly the problem I was having. I've copied the code into my application with a change for the report name and field name but get
run time error 3075
syntax error in query expression '([rec'd]>=#1/5/5# And [rec'd]<= #1/6/5"#)'.

Any suggestions please
 
Stupid question but, did you include "Between" before that string in your query?
 
OK, I've started again.

I've copied the code and associated it with a button. I've made a query with a drawing title field and a date rec'd field (rec'd). Generated a report, datetry. In the query I have criteria 'Between [txtStartDate] And [txtEndDate]' I know that the query works and I know that the report works. I just can't get the form to speak to the query/report.
 

Users who are viewing this thread

Back
Top Bottom