Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Reporting a specific range of entries

Posted on 1999-01-14
10
Medium Priority
?
215 Views
Last Modified: 2006-11-17
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

0
Comment
Question by:libido011397
  • 5
  • 4
10 Comments
 
LVL 7

Expert Comment

by:Dedushka
ID: 1973614
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
0
 
LVL 1

Expert Comment

by:billinb
ID: 1973615
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]
0
 

Author Comment

by:libido011397
ID: 1973616
Hate to ask.. but... what do I do with that?  Does this go in teh report code thing?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 7

Expert Comment

by:Dedushka
ID: 1973617
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
0
 

Author Comment

by:libido011397
ID: 1973618
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.


0
 

Author Comment

by:libido011397
ID: 1973619
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?
0
 
LVL 7

Expert Comment

by:Dedushka
ID: 1973620
libido,
please post here your table's structure
0
 

Author Comment

by:libido011397
ID: 1973621
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
0
 
LVL 7

Accepted Solution

by:
Dedushka earned 400 total points
ID: 1973622
Here i am, libido.

In 40-50 minutes i can prepare for you sample database and send it to you, OK?

Dedushka
0
 
LVL 7

Expert Comment

by:Dedushka
ID: 1973623
libido,
sample database is ready and wait for your e-mail. Write me to khamed@istnet.ru or let me know here.

Regards,
Dedushka
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question