Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Date Range for a report

Status
Not open for further replies.

jeprox

Technical User
Aug 3, 2001
12
0
0
US
I'm fairly new with Microsoft Access so please bear with me. I have created a report based on a table.
However, evrytime I preview this report, it will open all the data from that particular table. What I need to do is create a button that will ask for a date range. Subsequently, the report must only show the data from the dates I have specified. Like I said, I am fairly new at this so if there is some Idiot proof way to explain this, I would appreciate it very much.

I hope Im not bugging anyone on this board, but I have another question that I think is related to my first question. I have modified the built in template for the Order Entry in access 97. However, this only allows you to print Invoices not Packing lists. When you press the Preview invoice, it show only the invoice of that particular customer entry. But I need a packing list too (which doesnt show pricing etc.) So what I did was copy the Invoice and save it as a Packing List. Then I deleted some fields that I did not wish to be seen. But when I click on preview report on the button I created, it previews ALL the records. Not just the particular customer entry that is on the screen. It might sound stupid to some but any help is appreciated.

Thanks!
JEP
 
Re: Packing Slip
I'm assuming you used the wizard to create your button.

You need to add the where condition to the code the wizard created. Since you are using the Order Entry template, let's steal the code from the "Preview Invoice" click event and paste it into your "Preview Packing Slip" button's click event. Below is the code from "Preview Invoice" which I've modified to fit the packing slip button. I've highlighted the where condition in red. This is telling Access to open the report *where* the order id matches the id on the form. This is the piece that is missing from your code.

Private Sub PreviewPackingSlip_Click()
On Error GoTo Err_PreviewPackingSlip_Click
If Forms![Orders by Customer]![Orders by Customer Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter order information before previewing packing slip."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenReport "Packing Slip", acPreview, , "[OrderID] = Forms![Orders by Customer]![Orders by Customer Subform].form![OrderID]"
End If

Exit_PreviewPackingSlip_Click:
Exit Sub

Err_PreviewPackingSlip_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_PreviewPackingSlip_Click
End Sub


RE: Date range question
Have you worked with parameter queries?

 
Actually no I havent worked with parameter queries before.
 
Actually, it'd be much easier to make a query based on your table, and in the criteria section enter

BETWEEN [Beginning Date] AND [End Date]

When you pull up the form, it will prompt you for the Beginning Date and End Date fields, which you will type in the form of

01/01/2001

L8er,

Ry
 
I'm assuming you are using the Order Entry database and that you want to add this report to your switchboard. Correct? (Does your switchboard have a &quot;Change Switchboard Items&quot; option? I'm using Access 2000 and I don't remember if the Switchboard Manager is available in Access 97.)

Have you taken Ry's suggestion and based your report on a query rather than the table? If so, let's modify this parameter query so it gets it's values from a form rather than a user prompt.

In the Order Entry database there is a form called &quot;Report Date Range&quot;. What we are going to do is modify your query so it looks in this form for the date range.
 
great! Ill try all of these suggestions and Ill just bug you guys some more if I have any more questions.
Thanks a lot to everyone!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top