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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DoCmd.Close - more complete code?



 
 
Thread Tools Display Modes
  #1  
Old August 10th, 2009, 02:01 PM posted to microsoft.public.access.gettingstarted
CraigH
external usenet poster
 
Posts: 50
Default DoCmd.Close - more complete code?

Hi,
Well I will give you another point of view DON'T USE THE REPORT NAME
and you made my case for me.

DoCmd.Close acReport, "Report_Index", acSaveNo - DIDN'T Work

DoCmd.Close acReport, Me.Name DID Work - (you can add ,acSaveNo OR Yes to
this)
And btw Me.Name IS the name of the report - that is why it did work.

DoCmd.Close acReport, "Index Report", acSaveYes - DID work also BECAUSE you
had the correct name.

So why use the actual report name when you can type it wrong - use the
Me.Name - or if you know that the report is the active one the
screen.ActiveReport.Name.

And then what happens when you realize that for names of objects you
shouldn't use spaces and you change it to rptIndexReport. You have to
remember to go back into the code and change your code to close the report.



"StargateFanNotAtHome" wrote:

DoCmd.Close acReport, "Report_Index", acSaveNo


DoCmd.Close acReport, Me.Name
Docmd.close acReport, Screen.ActiveReport.Name


Hi!

Well, the above do work, it's just that neither name the report
either, which leaves me back with code no different than the
DoCmd.Close.

....

Okay, I went and looked again. I had the name wrong, somehow. What
shows up in the vbe is, obviously now, not the report's name (d'uh!).
I
This page, he http://msdn.microsoft.com/en-us/library/bb226008.aspx,
confirmed that I was on the right track.
As can be seen in the "Visual Basic for Applications" box, the
commands is, indeed, as I had found elsewhere on google:
DoCmd.Close acForm, "Order Review", acSaveYes

So I knew that my report name was probably what was at fault. Seems
to be working now, and I used this:

DoCmd.Close acReport, "Index Report", acSaveYes

I agree with the couple of posters whose advice I took, best to put
the actual report and form names in code of this type. I tend to
agree.

Thanks! D

 




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


All times are GMT +1. The time now is 01:57 AM.


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