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  

Command from Form to change Record Source of Report



 
 
Thread Tools Display Modes
  #1  
Old November 23rd, 2005, 04:09 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Command from Form to change Record Source of Report

I'm using VB to change the SQL Record Source of my Sub Form on my Main
form.
On my main form I also have a Command Button that opens a report.
What command could I use to set the Record Source of my report,
rpt_SEARCH

Thanks
Jeff

  #2  
Old November 23rd, 2005, 05:27 AM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Command from Form to change Record Source of Report

Could you limit the report with the WhereCondition of OpenReport?

Example:
If your subform is limiting the records where the InvoiceDate is in the last
3 months, you could:
Dim strWhere As String
strWhere = "[InvoiceDate] = DateAdd(""m"", -3, Date())"
DoCmd.OpenReport "Report1", acViewPreview, , strWhere

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"orbojeff" wrote in message
oups.com...
I'm using VB to change the SQL Record Source of my Sub Form on my Main
form.
On my main form I also have a Command Button that opens a report.
What command could I use to set the Record Source of my report,
rpt_SEARCH

Thanks
Jeff



  #3  
Old November 23rd, 2005, 01:26 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Command from Form to change Record Source of Report

orbojeff wrote:
I'm using VB to change the SQL Record Source of my Sub Form on my Main
form.
On my main form I also have a Command Button that opens a report.
What command could I use to set the Record Source of my report,
rpt_SEARCH

Thanks
Jeff


Unless you want to open the report in design view (not a good idea), the only
place the RecordSource of a Report can be changed is with code in the Open event
of that report. It cannot be changed "from the outside" like you can with a
Form.

Your form can either pass information to the Report so the Report's code knows
what to do, or you can have the Report's code "look back" at the Form to
determine what it should do.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


 




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
Toolbars, Drop-Down Menus Rick New Users 1 September 21st, 2005 11:17 AM
strategy for data entry in multiple tables LAF Using Forms 18 April 25th, 2005 04:04 AM
Help!! I'm running around in circles! CathyA New Users 19 December 12th, 2004 08:50 PM
dlookup miaplacidus Using Forms 9 August 5th, 2004 09:16 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM


All times are GMT +1. The time now is 08:46 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.