Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reporting a specific range of entries

Posted on 1999-01-14
10
Medium Priority
?
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

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!

Question has a verified solution.

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

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…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

715 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