Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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?

Or...
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:

Code:
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
[Transactions].[TDate])<[Forms]![frmAdjustments].[txtEndDate]+1))
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.
Reply With Quote
  #2 (permalink)  
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
Default

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?


mmcdonal
Reply With Quote
  #3 (permalink)  
Old November 6th, 2006, 10:36 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, mmcdonal.

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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.