Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 3rd, 2006, 05:07 PM
Registered User
Join Date: Aug 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Input, Parameters, Report Based on Query

I have a form where a user enters a start date and an end date in textboxes.
A report is created from a query using the start date and the end date entered
on the form as parameters. I created the report using the Wizard.

The form name is frmAdjustments.
The query name is qryAdjustments.
The report name is rptAdjustments.

How would I move the start date and the end date entered in the textboxes
to the report so the date range is displayed?

Can I use code to place the values in the text boxes of the form in textboxes or labels of the report?
For example: rptAdjustments.txtStartDate = frmAdjustments.txtStartDate.
The report is run when a View or Print button is selected. Could I place code in those click events
to do what I need?

Can I get the start date and the end date from the parameters directly from the query?
Is there a way to include the parameters in the SELECT statement to enable the report
to access them? Here is the query:

PARAMETERS [Forms]![frmAdjustments].[txtStartDate] DateTime, 
[Forms]![frmAdjustments].[txtEndDate] DateTime;
SELECT [Hoods].[Fabric], [Hoods].[Degree], Sum([Transactions].[Adjustments])
AS Added,
Sum([Transactions].[AdjRemove]) AS Removed
FROM Hoods INNER JOIN Transactions ON [Hoods].[ID]=[Transactions].[BoxID]
WHERE ((([Hoods].[Fabric])<>'ALL'
And ([Hoods].[Fabric])<>'Other') And (([Hoods].[Degree])<>'ALL'
And ([Hoods].[Degree])<>'Other'))
And ((([Transactions].[TDate])>=[Forms]![frmAdjustments].[txtStartDate] And
GROUP BY [Hoods].[Fabric], [Hoods].[Degree];
I hope my question is clear. Basically, I want the two dates used as parameters to display at the top
of the report. The form, query, and report all work correctly.

Thanks for any suggestions.
Old November 6th, 2006, 08:22 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Create the start date and end date text boxes on the report, and set their data source to the text boxes on the form.

Did that help?

Old November 6th, 2006, 10:36 AM
Registered User
Join Date: Aug 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks, mmcdonal.

I had tried that before posting but got a syntax error that I could not find. I finally got it to work.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Query parameters from a Form DrCruces Access 6 December 13th, 2006 05:42 AM
saxon input parameters Tomi XSLT 1 September 13th, 2006 09:24 AM
Execute DTS with input parameters from a SP dbradley SQL Server 2000 6 March 22nd, 2006 05:36 AM
Report based on query programatically nabrown78 Access VBA 2 March 22nd, 2005 08:57 PM
SQL query from input form skywalk22 SQL Server ASP 7 October 21st, 2004 09:24 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.