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. |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
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 | |
|
|