[AccessD] DoCmd.OpenFrom acHidden is not hidden

Gustav Brock gustav at cactus.dk
Fri Mar 15 09:29:21 CDT 2013


Hi Rocky et al

It is A2010.
That's a good idea. However, there are too many forms behaving this way so
it might not work that well in this app.

However, I found out that it was the loading of data for a subform that
brought the loading to a crawl. It is linked to an SQL Server.
So what I did was to have a textbox, LinkId, as the masterlink and bind it
to a fixed value saved with the form:

  =-1

This, of course, force the subform to pull zero records, and it opens rather
quickly. The frame of the form is no longer drawn on the screen.
Then, when the form has opened, I change the controlsource of LinkID to make
it bound to ID:

<code>
Private Sub Form_Activate()

    Static booActivated As Boolean
    
    If booActivated = False Then
        Me!LinkID.ControlSource = "ID"
        booActivated = True
    End If

End Sub
</code>

That works. Opening is slow, but an hourglass is shown and - when ready -
the form including the subform opens like you would expect it to.

/gustav


-----Oprindelig meddelelse-----
Fra: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] På vegne af Rocky Smolin
Sendt: 15. marts 2013 14:11
Til: 'Access Developers discussion and problem solving'
Emne: Re: [AccessD] DoCmd.OpenFrom acHidden is not hidden

This probably won't help but I do this in an app where a form opens so
slowly (lots of calcs and query data) that I open it hidden in the Open
event of the opening log in form:

DoCmd.OpenForm "frmRentalAgreement", , , , , acHidden

And keep it open hidden all the time the app is open.  When I want it to
show:

DoCmd.OpenForm "frmRentalAgreement"

And when I want it to disappear:

Me.Visible = False

on exiting the form, so it stays open all the time but hidden.

This is in A2K3, so later versions might not work the same.

Rocky


 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Friday, March 15, 2013 1:31 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] DoCmd.OpenFrom acHidden is not hidden

Hi all

>From a form I try to open another form hidden by clicking a button:

  DoCmd.OpenForm "frmSomeForm", acNormal , , , , acHidden

Then the hidden form is supposed to do some calculations and, when finished,
unhide itself by means of a not visible textbox bound to a function:

  =SetVisible()

which contains:

Private Function SetVisible() As Boolean 
    Me.Visible = True 
    SetVisible = True
End Function

The sequence works except for one thing - the form isn't opened hidden
because its frame is shown at once.
Thus, the sequence is:

1. Frame of hidden form is shown on top of the calling form. The form itself
is transparent so the calling form is still visible inside the frame.
2. The "hidden" form performs the calculations.
3. The "hidden" form paints its inside invisibly.
4. SetVisible is called.
5. The completed form is visible.

I've also tried opening the hidden form with:

  Set frm = New Form_frmSomeForm
  frm. Visible = False

No difference. Also having this in the OnOpen event of the form:

  Me.Visible = False

All to no avail.

Any ideas for opening a form completely hidden?

/gustav 




More information about the AccessD mailing list