Link to home
Start Free TrialLog in
Avatar of libido011397
libido011397

asked on

Reporting a specific range of entries

This is probably a simple question for those experienced in Access97 or those with a book, so I'm setting it at 100 points.  I'll raise it if the solution is more complicated than normal.

I have a client database for my business, and I'd like to report the charges that have been made during a specific date range.  Using some sample databases I managed to get the report to request the date range (and it successfully shows in the report "Billing from [datex] to [datey]")

I can't find any info in the code or anything in the sample databases that do this... I'm probably leaving out a lot, please feel free to ask me to elaborate on more.

- Hugh Buchanan
- HarveyOpolis

Avatar of Dedushka
Dedushka

Hi, libido!

Here is samle from Access on-line help:
---------
This example lists the name and contact of every customer who placed an order in the second quarter of 1995.
This example calls the EnumFields procedure, which you can find in the SELECT statement example.

Sub SubQueryX()

      Dim dbs As Database, rst As Recordset

      ' Modify this line to include the path to Northwind
      ' on your computer.
      Set dbs = OpenDatabase("Northwind.mdb")
      
      ' List the name and contact of every customer
      ' who placed an order in the second quarter of
      ' 1995.
      Set rst = dbs.OpenRecordset("SELECT ContactName," _
            & " CompanyName, ContactTitle, Phone" _
            & " FROM Customers" _
            & " WHERE CustomerID" _
            & " IN (SELECT CustomerID FROM Orders" _

& " WHERE OrderDate Between #04/1/95#" _
            & " And #07/1/95#);")
      
      ' Populate the Recordset.
      rst.MoveLast
      
      ' Call EnumFields to print the contents of the
      ' Recordset. Pass the Recordset object and desired
      ' field width.
      EnumFields rst, 25

      dbs.Close

End Sub
--------

Hope it will help you.

Good luck,
Dedushka
It sounds like you just need to enter the parameters into the underlying query of the report.
There are several ways to do this, I think the following MS site has an excellent example -

Q141613
(After bringing the report's underlying query up in design mode, by either clicking the data source in the report, or creating a new query entirely;)
On the Query menu, click Parameters. In the Query Parameters box, under Parameters, type "Enter Start Date" (without the quotation marks), and under Data Type enter "Date/time" (without the quotation marks). Press TAB to move to the next Parameter field. Under Parameters, type "Enter End Date" (without the quotation marks) and under Data Type, enter "Date/time" (without the quotation marks). Click OK.
.etc...
Add the following criteria for the (Billing) field:
      Between [Enter Start Date] And [Enter End Date]
Avatar of libido011397

ASKER

Hate to ask.. but... what do I do with that?  Does this go in teh report code thing?
libido,
it is not answer, it's only comment...
If you want to create report about "the charges that have been made during a specific date range", then you should
1.Create the Charges table
2.Create query, that select fields needed for your report
3.Create report based on above mentioned query
4.Open your report directly or using button on the form.

If you want open your report directly from database window, then your query must inlcude parameters, as discribed in billinb's answer.
if you want to use a button, then you should attach to this button's OnClick event some code:
.
DoCmd.OpenReport "MyReport",,,"[ChargedDate] between #" & me.[datex]& "# AND #" & me.[datey] & "#"
.

where datex and datey is text boxes, placed on your form.

Best regards,
Dedushka
Could you explain more... I am unsure how to even create a query under the report.  The example database that lists things by date doesn't have any queries.


Well, I have created a query.. which contains only the BillingDate table entry.. (should it have more?)

How do I link the Query to the form, etc?
libido,
please post here your table's structure
Well, it's a fairly simple table:

Billing : Table
ContactID - Number (linked to Contacts : Table)
BillingID - AutoNumber
PaymentAmount - Currency
Payment Date - Date/Time
CreditCardNumber - Text
CreditCardExpDate - Text
ASKER CERTIFIED SOLUTION
Avatar of Dedushka
Dedushka

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
libido,
sample database is ready and wait for your e-mail. Write me to khamed@istnet.ru or let me know here.

Regards,
Dedushka