Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #31  
Old October 20th, 2012, 12:07 AM
DaddyBig63 DaddyBig63 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 1 DaddyBig63 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 27 sec
Reputation Power: 0
Finally Found My Answer To This!

I was having a similar issue trying to figure out how to pass query parameters to a chart object on my bound report. I designed my query SQL selection in query designer and rather than parametize the query, assigned fully qualified report field references to my query. To do this, I added unbound fields to my report for the parameters that would complete my query. In my case, a start and an end date value. In the report open event, I manipulate the control source of each unbound field (serving as my parameters).
Code:
Me.param1.controlsource = "=CDate('" & str_p_RptStart & "')"
The unbound field on the report can be named whatever; I'm using param1. By the way, I hide these fields on my report. On the report, I assign my SQL select criteria to my chart objects RowSource parameter which includes in the Where clause a fully qualified reference to my unbound field.
Code:
SELECT MyField FROM TableName WHERE Created > [Reports]![MyReportName]![param1]
Now, the only thing I need to do is have my code set a date in the public variable str_p_RptStart. My chart object on the report changes everytime I run the report based on the new date criteria. Although I use a dialog to capture the dates, it could all be performed from within the report Open event.

I hope this helps someone. It sure would've saved me hours of research and lots of trial and error. Seems so simple once it works. If anyone needs more info, let me know. Also, I don't claim to be an expert at VBA, SQL, or Access. I would be more than happy to have someone tell me there is a better way.

DaddyBig

Last edited by DaddyBig63 : October 20th, 2012 at 12:14 AM. Reason: Fix CRs

Reply With Quote
  #32  
Old November 14th, 2012, 06:41 AM
Nelson5111 Nelson5111 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 5 Nelson5111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 15 sec
Reputation Power: 0
--------------------------------------

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Pass Parameters from VBA to Query


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap