A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Changing the record source depending on user selection



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2005, 06:47 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Changing the record source depending on user selection

I built a report that relies on a query "SalesByDepartment". I built an
identical report which relies on a query called "SalesByBusinessUnit. I also
created an option group on a form, so that when you choose Department, it
will print the department report and if you choose Business Unit it will
print hte other report. I am about to built another identical reports by
area, chapter etc and was wondering if there is a way to change to record
source of the SAME report from "SalesByDepartment" to "SalesByBusinessUnit.
I would also like to change some text box caption and control source based on
a user selection and thus saving a lot of time and hassle.

Thanks in advance for your help.

Arnon
  #2  
Old December 2nd, 2005, 09:30 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Changing the record source depending on user selection

Arnon wrote:

I built a report that relies on a query "SalesByDepartment". I built an
identical report which relies on a query called "SalesByBusinessUnit. I also
created an option group on a form, so that when you choose Department, it
will print the department report and if you choose Business Unit it will
print hte other report. I am about to built another identical reports by
area, chapter etc and was wondering if there is a way to change to record
source of the SAME report from "SalesByDepartment" to "SalesByBusinessUnit.
I would also like to change some text box caption and control source based on
a user selection and thus saving a lot of time and hassle.



You can do all that in the report's Open event procedu

Dim strQuery As String
Select Case Forms!theform.theoptiongroup
Case 1
Me.RecordSource = "SalesByDepartment"
Me.lblTitle.Caption = "Department Sales Report"
. . .
Case 2
Me.RecordSource = "BusinessUnitReport"
Me.lblTitle.Caption = "Unit Sales Report"
. . .
Case 3
Me.RecordSource = "SalesByBusinessArea"
Me.lblTitle.Caption = "Area Sales Report"
. . .
Case 4
Me.RecordSource = "SalesByBusinessChapter"
Me.lblTitle.Caption = "Have a nice day"
. . .
Case Else
MsgBox "Need to add the new query to this list"
End Select


--
Marsh
MVP [MS Access]
 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple filter query of form truepantera Using Forms 6 August 4th, 2005 08:26 AM
User Saving a Record else it deletes Carter Wexler Using Forms 1 August 2nd, 2005 11:57 PM
Creating Records in tables automatically peterg290935 Using Forms 8 June 22nd, 2005 08:12 AM
Need Help In Printing Current Record in Specific Report RNUSZ@OKDPS Setting Up & Running Reports 1 May 16th, 2005 09:06 PM
Procedure run (Access open / Close) Niklas Östergren General Discussion 9 December 29th, 2004 02:02 PM


All times are GMT +1. The time now is 04:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.