Me.Visible=False not working

jsic1210

Registered User.
Local time
Today, 09:10
Joined
Feb 29, 2012
Messages
188
Okay, this one is driving me crazy. I'm trying to open a report with pop-up form. When the report opens, I want the form to stay loaded, but hidden. I'm using Me.Visible = False, but it's not working. Here is my code:
Code:
On Error GoTo SubError

'Open Report
    DoCmd.OpenReport "rptCPUWeeklySummary", acViewPreview, , "Year([Month Ending Date]) > " _
        & Year(Me.txtMonthEnding) - 2

SubExit:
    Me.Visible = False
    Exit Sub
SubError:
    MsgBox Error$
    GoTo SubExit
 
Did you try referring to the form (i.e. Forms!"FormName".Visible=False) instead of using Me?
 
Where is this code? "Me" refers to the class in which code is currently running which in this case is not the same object as the form you just opened using DoCmd.

Check out the acHidden WindowMode parameter of DoCmd.OpenForm(), which does exactly what you'd think . . .
Code:
DoCmd.OpenForm "SomeForm", , , , , acHidden
 
Lagbolt,
I see what you're saying, but it's the pop-up I want to be invisible, not the report that I just opened.
 
Is the pop-up programmed to open automatically when the report is opened or is it already open when the code to open the report is executed?

You could close the pop-up and reopen it as hidden. Seems roundabout but would prob work.
 

Users who are viewing this thread

Back
Top Bottom