MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 15th, 2004, 10:27 AM
jstmauri jstmauri is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Guelph
Posts: 2 jstmauri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Trying to setup filters for subreports

Greetings all,

I'm not sure if this is the best place for this post but here it goes anyways. I have a report that lists an account's budgetline status (how much money has been used in each, etc.) and an account's recent transactions. The information is coming from two tables into two subreports and I want to write a function that will take a parameter (an account name, for instance) and a period (fall 2004, for instance) and will setup (or filter, link) the report with all that account's budget lines and transactions. Thus far I've tried using filters to accomplish this without much luck (see code below). I've also tried linking the subreports .RecordSource to an SQL recordset, which didn't work either. Anybody have any ideas or suggestions on how I could go about setting this up? Eventually I want to have a function that prepares a report, e-mails it and prepares another and e-mails it in a loop, so this function should ideally be pretty generic.

In summary, I want to write something in VBA that will prepare a report given parameters and I want feedback/code that would help me approach it in the best way.


''my attempt to setup a filter

DoCmd.OpenReport AccountReportTemplate, acViewPreview

Filterstr = "((([" & BudgetDatabase & "].Account) = """ & Account & """) And (([" & BudgetDatabase & "].Period) = """ & Period & """)))"

[Reports]!ACCOUNT_REPORT.BUDGETsub_report.Form.Filter = Filterstr 'I get the error "the setting you entered isn't valid for this property"

[Reports]!ACCOUNT_REPORT.BUDGETsub_report.Form.Requery

Filterstr = " ((([" & TransactionDatabase & "].[Account])=""" & Account & """))"

[Reports]!ACCOUNT_REPORT.Form.Filter = Filterstr

[Reports]!ACCOUNT_REPORT.Form.Requery


thanks all,

- Justin

Reply With Quote
  #2  
Old June 15th, 2004, 12:31 PM
jstmauri jstmauri is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Guelph
Posts: 2 jstmauri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Also...

I'm also trying to work along these lines, but I'm not making much headway.

DoCmd.OpenReport AccountReportTemplate, acViewPreview

[ACCOUNT_REPORT].BUDGETsub_report.Form.Recordset = GetAccountTransactions("Central")

where GetAccountTransactions returns a recordset.

- Justin

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Trying to setup filters for subreports


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway