opening report from form with variable recordsource - 151879

I am opening a report  from a form in designview while changing  the
recordsource. (see code below)
This works well, the report opens with the appropriate data source
but when I am closing the report wiht the "close" button (print preview
toolbar), it opens in design view.
This does not happen when I close the report with the "close window" x on
the right side of the menu bar?
Anybody an idea how to make it work from the close button as well?

    Me.application.Echo False
    Dim stDocName As String
    stDocName = "Rpt1010_FinancialOverviewByMonth_Graph"
    DoCmd.OpenReport stDocName, acViewDesign
    Reports!Rpt1010_FinancialOverviewByMonth_Graph!Graph1.RowSource =
"SELECT * from        Qry1010_ExpensesGraph WHERE [periodval] >= " &
Me.cboGraphStart & " and [periodval] <= " & Me.cboGraphEnd
    DoCmd.Save  ( OR I tried DoCmd.Save acReport,
"Rpt1010_FinancialOverviewByMonth_Graph")
     DoCmd.OpenReport stDocName, acPreview
Me.application.Echo True
(I also tried to save after going to preview, no difference)



0
phleduc
11/29/2007 4:42:45 PM
access.reports 4434 articles. 0 followers. Follow

1 Replies
600 Views

Similar Articles

[PageSpeed] 7

I would probably set the graph Row Source to a saved query and use code to 
change the SQL property of the query.

Dim strSQL as String
strSQL ="SELECT * from Qry1010_ExpensesGraph " & _
    "WHERE [periodval] >= " & Me.cboGraphStart & " and [periodval] <= " & 
Me.cboGraphEnd & ";"
CurrentDb.QueryDefs("qselForGraph").SQL = strSQL
DoCmd.OpenReport ....

-- 
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP 
http://www.access.hookom.net/UCP/Default.htm


"phleduc" wrote:

> I am opening a report  from a form in designview while changing  the
> recordsource. (see code below)
> This works well, the report opens with the appropriate data source
> but when I am closing the report wiht the "close" button (print preview
> toolbar), it opens in design view.
> This does not happen when I close the report with the "close window" x on
> the right side of the menu bar?
> Anybody an idea how to make it work from the close button as well?
> 
>     Me.application.Echo False
>     Dim stDocName As String
>     stDocName = "Rpt1010_FinancialOverviewByMonth_Graph"
>     DoCmd.OpenReport stDocName, acViewDesign
>     Reports!Rpt1010_FinancialOverviewByMonth_Graph!Graph1.RowSource =
> "SELECT * from        Qry1010_ExpensesGraph WHERE [periodval] >= " &
> Me.cboGraphStart & " and [periodval] <= " & Me.cboGraphEnd
>     DoCmd.Save  ( OR I tried DoCmd.Save acReport,
> "Rpt1010_FinancialOverviewByMonth_Graph")
>      DoCmd.OpenReport stDocName, acPreview
> Me.application.Echo True
> (I also tried to save after going to preview, no difference)
> 
> 
> 
> 
0
Utf
11/29/2007 5:12:00 PM
Reply:

Similar Artilces:

Form fields vs. document properties
I'm creating common templates for multiple dealers of the same product. For example, one dealer may open my "Client Guide" document and all he needs to do is update approximately 20 fields and he is done. I'm using the standard document properties fields for my company information, but there are 10+ more unique fields I need to do this for. I've been trying all night to use quick parts, building blocks, etc. to accomplish this but I am really struggling. I can use a fill-in field, but it prompts for the field every place I use it. I've enabled th...

WIP Detail Report
Is there a (field within a) SQL table that indicates whether or not a cost transaction posted to a Project is in WIP or has been cleared from WIP? This would enable me to reconcile nicely to WIP in the GL, and I'd like to add a marker to our Project Cost Breakdown report to distinguish which cost lines have been billed, and which have not. For example, I've found PA23203 seems to show line items tagged/billed for T&M jobs, but I haven't found one for FP ones yet. Ideally, there would be a Master cost detail table with a field that could be used as a marker. Any suggest...

Sub Form
I have a main form and a subform each has a table. The problem I'm running into is when I get to the subform, and try to enter info into it nothing happens. Also if I click in the subform it'll work but it starts at the last field in the subform. I need it to go to the first field on the subform. How would I get it to do this? I was told something about the label from the subform that something has to be entered into this. Thanks > when I get to the subform, and try to enter info into it nothing happens. What do you mean? Are you saying that you cannot even enter data in y...

require cell completion in a form?
I have a very simple form in Excel. I'm not sure if it matters, but the machine I'm on uses Excel 2002, and most of the users are on Excel 2000. The first 2 questions on my form require that the user select from a list of names, and then select their relationship to that person. Then the users answer a series of questions about this person's job performance. I'm using data validation to manage the two drop-down lists - the names and the relationships. However, about a third of my users end up leaving one or both of these cells blank. I have a comment box set up as a remin...

Can't open spreadsheet from website
I can't open an Excel 2000 document in IE6. An Excel window opens but the spreadsheet won't display. The document contains several worksheets and one contains a textbox (which might be a problem). I need to be able to view, from this website, 22 worksheets per catagory with 4 catagories total. Help!!! ...

how to create escalation form
How do I create escalation form. Abe wrote: > How do I create escalation form. Since you're the only one here who knows what you're escalating, to whom, in what way and for what reason, you are the only one who can tell what the form should look like. In general, you should create a Word template: http://www.word.mvps.org/FAQs/Customization/CreateATemplatePart1.htm If the form needs to have text that doesn't change, and places to enter text that does change, then you should create it as a form template: http://www.word.mvps.org/FAQs/TblsFldsFms/LinesInForms.h...

cannot open attachments when sent to a group
Hi, has anyone had the following problem, and any hints on how to fix? I have a user who sends a word document to 12 people (in 12 different locations/businesses) 10 of them can open the document - 2 cannot. If the document is sent to the 2 seperately (not as part of a group e-mail) they CAN open it. Does anyone have a solution? Many thanks Paul ...

Adding member variable (CEdit control) for edit box causes Unhandled exception
Hi, I have a simple dialog project. It has an edit box, which I've mapped in ClassWizard to a CString, m_Input. I wanted to be able to set the cursor back to this edit box and highlight text in the edit box, so I created a another member variable in ClassWizard, m_Input_Control, which is mapped to the same edit box, but is a CEdit control. This compiles all right, but whenever I try to run the program after adding the above member variable (even if I don't access it in my code), I am getting an "Unhandled exception". Deleting the CEdit control member variable fixes the p...

Management Reporter
Hi, Please can you explain to me why if MR is run on IIS why it cannot be accessed as a website and instead seems to need a MR client installed? If it is possible to run \ view reports via Internet - how do I go about doing this please? I ask as my client wishes to have MR incorporated into their Sharepoint website - please advise if this is possible and if so then how? Thank you Neil ...

Sales Pipeline Report #2
Anybody had problems with this report in terms of the group by Date function. Cannot get the date order of the report to work in terms of ordering by Estimated Close date. Am posting here in the attempt to get anyone out there to help me please... have been pulling my hair out in looking at the query in this report to work out how to order by Estimated Close Date! Thanks in advance, Charlie Absolutely. The CRM 4.0 Sales Pipeline report group by Date does not work correctly when using non-US CRM date formats. I have logged this as an issue with MSFT support, who accept there is a ...

Stock Option Reporting
I am trying to run a Capital Gains report but my Stock Options are not showing up on the report. Does anyone know a work around to report on Stock Options? SMc In microsoft.public.money, shaunx4 wrote: >I am trying to run a Capital Gains report but my Stock Options are not >showing up on the report. Does anyone know a work around to report on Stock >Options? If you are looking at Reports->CapitalGains report in Money 2006 Deluxe, why would your employee stock option be expected to show up on that report? Maybe I should have clarrified. I am trying to view stock options th...

When Excel Opens it Starts with Book2
Anyone know why excel would open to book2 and not book1. Hi Tracey! This means that a file with the Book1 name has already been saved. Find it using Start > Search > For Files and Folders Check the contents and either rename or delete. -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. ...

Creating Forms
I want to create a form on my website but do not know which program to use. Should using html be adequate for the purpose? On 26 Mar 2007 10:16:47 -0700, stromo wrote: > I want to create a form on my website but do not know which program to > use. Should using html be adequate for the purpose? You have posted this message to the wrong newsgroup. The access in this groups name refers to Microsoft Access, a database program. Please repost to the correct newsgroup for whatever Office program you are using. I would suggest you include your Windows and Office version number in the message...

Z report total
How do I print a total z report that has all the batches for one day? -- Thank you Terry Terry, This is not functionality that is present out of the box. We have created a customized solution called the consolidated Z report. If you are interested in learning more, please give me a call or drop me an email. -- Thank you, Ryan Sakry Program Manager Retail Information Technology Enterprises 320-230-2288 rsakry@rite.us www.rite.us "Terry" <Terry@discussions.microsoft.com> wrote in message news:CB404C7B-4AD2-4466-86E7-168CC27A791C@microsoft.com... > How do I print a t...

you do not have credentials that allow you to open this document
When i open a existing .doc document.It shows message "like you do not have credentials that allow you to open this document.Do You want to open it using a different set of credentials? " i can't able to open any .doc document ...

Opening a blank form
Hi guys, I created a form to consult data, the record source is a query that gather information from different tables, the problem is when I open the form it shows data already, I want a blank form when it opens, I already tried including DoCmd.GoToRecord , , acNewRecord in the open from event, but I get “You can go to the specified record”, if I go to the query I can’t modify the data or add a new record that is why the acNewRecord is not working. I’ll really appreciate any help Thanks Maracay wrote: >I created a form to consult data, the record source is a query ...

Excel file won't open because it' a read only file when it is not
When I try to open a file I just had open, the following message appears - Cannot access read-only document "name of file" File properties do not have the read-only box ticked. Maybe: http://contextures.com/xlfaqApp.html#ReadOnly or http://contextures.com/xlfaqApp.html#AlreadyOpen Both from Debra Dalgleish's site. IanB wrote: > > When I try to open a file I just had open, the following message appears - > Cannot access read-only document "name of file" > File properties do not have the read-only box ticked. -- Dave Peterson ...

How to open multiple cases
Does anyone know if there's a way to open a case for several companies at one time? I've got a situation where I need to deploy a service bullitin for serveral companies. The title, description, etc.. are all the same. Thanks. Hmmm. Do you really need to open cases at first? If it's just a bulletin, then maybe you create a campaign to notify the appropriate customers, and then track the responses against the campaign. -- Microsoft Certified Professional - Dynamics CRM http://www.bturnkey.com "Coco" wrote: > Does anyone know if there's a way to open a ca...

New personal finance resource website open #2
--_NextPart_00009772-00002116-10DD2067-6005 Content-Type: text/plain Content-Transfer-Encoding: 7bit New Personal Finance Resource Website Open http://www.your-personal-finances.com/ - Free articles and information on personal finance --_NextPart_00009772-00002116-10DD2067-6005-- *** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** ...

Not able to open .xls outside of excel (via Explorer or Outlook attachment)
After upgrading to MS Outlook 2003.....when I find my .xls on my hard-drive using Windows Explorer & then double-click on the file....Excel opens, but does not populate with the desired file. Similar situation with an .xls file attached to an email (even one I sent), I double-click on the attached file's icon & Excel starts, but I get an error on Outlook that the file could not be located. I can then go to Excel/File/Open & choose the file & it opens with no problems. Word .doc files, .pdf's etc. open normally from outside their programs. I have cleared & ...

Report Header Question
Hi, hope someone can help me with a problem I've run into whilecreating a report.I have a report where I must use three different Headers to obtain theinformation I need (Downtime, ProductNumber, and CustomerLotNumber).The information is in three headers, but in different locations ineach header (which if combined, could be in a straight line). Theclient wants totals for the information pertaining to Downtime,ProductNumber, and CustomerLotNumber, but he doesn't want them bydetail. The only way I could think to accomplish this was to createseparate Headers which would give the informa...

Report Not Printing
We are running version 3.0 of CRM and I have one workstation that cannot print reports presently. My workstation works fine so far it seems only isolated to the one workstation. What happens is they get the report up on the screen but when they hit the print button they get an error on page. The details on the error are similar to below. Line: 20 Char: 4 Error: Object doesn't support this property or method Code: 0 URL: http://ddcrm/ReportServer?%2fDesigner+Doors_MSCRM% 2fCustomer+Acceptance+Resolved+Issues&Resolveddate=10%2f1% 2f08&rs%3aCommand=Get&rc% 3aGetImage=8.00.1...

Form/ subform link problems
My parent form holds information about a part and my subform holds ordering information for that part. Up to now I have linked the child to the parent via PartID : RecordID and Component Name : Component name. This is great as it shows the component name on the subform after it has been found on the parent form. The only problem with this is if the user changes the component name it does not keep the order information for the same item with the old name. I want to link purely on the partID : RecordID so that whatever else is changed the order information history still shows. When I do t...

FRx Reporting Tree Link to Great Plains 8.0 Segment Descriptions
We are making extensive use of FRx reporting trees, rows and column formats, etc. In all case, we can link back to Great Plains accounts, segment codes, etc, but we cannot pull over the corresponding descriptions (ie from GL40200) in Great Plains. So we end up having to re-enter all the segment descriptions into FRx. So we are maintain the descriptions in two places Great Plains and FRx. This seems really, really stupid, for an integrated product. Am I missing something? If anyone can help me avoid this duplication of work, I would be eternally grateful. Any/all thoughts are ver...

Management Reporter 07-14-10
Anyone can help me with this message 'Windows Authentification is not supported for Dynamics GP' when the MR migration wizard process the 'Convert Data To Frx step. After that, in MR, no accounts are dsiplayed on the converted row formats. Thanks. For the ODBC driver you are using, is it set up for Windows Authentication? "SLami" wrote: > Anyone can help me with this message 'Windows Authentification is not > supported for Dynamics GP' when the MR migration wizard process the 'Convert > Data To Frx step. > After that, in MR, no ...