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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Specific Date Invoices

Status
Not open for further replies.

jasonstewart

Programmer
Mar 14, 2002
39
US
I would like to print reports after asking a question of what days would you like to print Nov 23 - Dec 1 like that. How can I accomplish this. I would like to do this of reports that I have already designed.
 
Try Below Steps
Step 1: Design a Form (Say Form1) With Date Text Field (Say txtDate) and a Command Button
Step 2 : Create a Query (Say Query 1) : - Select * from [Your Table Name] where [Date Field] = Form!Form1!txtDate
Step 3 : Create a Report (Say Repor1) and assign Query1 as Record Source
Step 4: Open Report 1 in Form1- Command Click Event - DoCmd.OpenReport "Report1", acViewPreview

Hope this helps
 
Just adding on to essnrv:

CREATE A FORM (call it Form1)
* Add 2 text fields, name one 'StartDate' and the other 'FinishDate' (have these hidden if you like)

* Add a button - call it 'GetDates'. In its 'On Click' event add the following code:

Private Sub GetDates_Click()
On Error Resume Next

Dim CentreVal As Integer
Dim txtDate As String
Dim stDocName As String

StartDate = ""
FinishDate = ""
txtDate = InputBox("Enter Dates (eg. Nov 23 - Dec 01)", "INPUT DATES")
CentreVal = InStr(txtDate, "-") - 1
If CentreVal <> 0 Then
If IsDate(Format(Left(txtDate, CentreVal, &quot;Short Date&quot;)) = True Then
If IsDate(Format(Right(txtDate, CentreVal, &quot;Short Date&quot;)) = True Then
StartDate = Trim(Left(txtDate, CentreVal))
FinishDate = Trim(Right(txtDate, CentreVal))
stDocName = &quot;Report1&quot;
DoCmd.OpenReport stDocName, acPreview
End If
End If
End If
End Sub

Report1 that the above code refers to is linked to a Query (Query1) which looks like this:

SELECT [Your Table Name].*
FROM [Your Table Name]
WHERE ((([Your Table Name].[Date Field]) Between [Forms]![Form1]![StartDate] And [Forms]![Form1]![FinishDate]));

Note that YEAR is not taken into account so it is always assumed that year = current year. However, this code should still work with years added...ie. &quot;23 Nov 01 - 01 Dec 03&quot;
[yinyang]
 
I am reading my question and wondering why I was so vaige. Let me try harder to explain. I have several reports already designed and working printing all of the information from my one table. I don't want to make a new report just filter the one I am currently using. Is that possible? Thank you for any input.

 
Is your report based on a query?

Criteria:

Between [Enter Start Date] And [Enter Finish Date]
 
My report is just a regular report, there is no between or anything. I just used the report creator to make it. But it uses a one to many relationship for line items. So it is a fairly involved and don't really want to redesign it.
 
Can you send? I'll need to look at this first-hand...my address is shannonp@xtra.co.nz
 
OK

I've looked at your DB, and there are MANY possibilities. However, I think the quickest and dirtiest way to handle this is to filter your reports...try this:

1. Open your 'AB Invoice' Report
2. Go to Report Properties and select the Data Tab
3. In 'Filter' type the following line:
[ServiceDate] Between [Enter Start Date] And [Enter Finish Date]
[sunshine] This is where you will be prompted to: &quot;Enter Start Date:...&quot; and &quot;Enter Finish Date...&quot;
4. In 'Filter On' change value to &quot;Yes&quot;

You should be able to enter dates in any style you like. And you should be able to repeat this method for all your reports.

Hope this helps
[yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top