Full Version: Form That Wont Go Invisible!
UtterAccess Forums > Microsoft® Access > Access Forms
M2C
Hi
I have a form that I launch a report from using a button with the following:
orms!FrmSwitch.Visible = False
DoCmd.OpenReport "RptSpend", acViewPreview, "", "", acNormal
Reports!RptSpend.LblTitle1.Visible = False
On the report I would like to make a label on the report called LblTitle1 invisible as above. I would expect the code above to do this which it does, however I also want the form FrmSwitch to go invisible too whcih it does but only for a fraction of a second and then reappears. Any ideas how to make both the label and the form stay invisible. If i remove the code
Reports!RptSpend.LblTitle1.Visible = False
The form FrmSwitch disappears fine and then reappears when the report is closed, so i know that bit works.
Cheers
Chris
Alan_G
Hi
ther than maybe there's some code running in either the report itself or after the snippet you've posted that resets the form's visible property I can't think why it shouldn't stay hidden. Have you tried putting a break point on the first line and stepping through it so you can see what's happening ?
Don't see why ot should make any difference, but maybe try it the other round -
CODE
DoCmd.OpenReport "RptSpend", acViewPreview, "", "", acNormal
Reports!RptSpend!LblTitle1.Visible = False
Forms!FrmSwitch.Visible = False
M2C
Thanks Alan, you got me thinking
The answer is I had
CODE
Forms!FrmSwitch.Visible = True

running on the OnClose of the report and for some reason it go triggered despite I never closed the report. So I moved the same code to the OnDeactivate and it has resolved the issue.
Thanks
Chris
Alan_G
glad you found it
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.