Invisible form (1 Viewer)

L4serK!LL

Registered User.
Local time
Today, 21:07
Joined
Jul 22, 2002
Messages
59
Got a form here that has an exit button...
However, for reasons of performance, when you push the exit button, the form simply gets invisible...
Now, whenever the form is loaded i want a new record added (DoCmd.GoToRecord , , acNewRec). I put it in the Form_Load but of course this code isn't executed when then form is made visible again... :(
Where to put the code to be executed when visibility is back again...?
 
Last edited:

Graham T

Registered User.
Local time
Today, 21:07
Joined
Mar 14, 2001
Messages
300
Try the On Load event or On Activate event, these may do the trick.

Graham
 

L4serK!LL

Registered User.
Local time
Today, 21:07
Joined
Jul 22, 2002
Messages
59
Tried the On Load but didn't do the trick, On Activate on the contrary seems to do the job :)
 

ghudson

Registered User.
Local time
Today, 16:07
Joined
Jun 8, 2002
Messages
6,195
I would add the new record within the event that you use to make the form visible again. Or within that same event you could test if the form is visible and add the record if it is true.

HTH
 

L4serK!LL

Registered User.
Local time
Today, 21:07
Joined
Jul 22, 2002
Messages
59
ghudson said:
I would add the new record within the event that you use to make the form visible again. Or within that same event you could test if the form is visible and add the record if it is true.

HTH
Hmm you remind me of something I'm not sure about...:

Does "DoCmd.OpenForm stDocName, , , stLinkCriteria" revoke and invisible form or load a second version...?"

Quite important to know as I'm using this now in the event to make it visible again (same button is used to open the form the first time) :confused:
 

ghudson

Registered User.
Local time
Today, 16:07
Joined
Jun 8, 2002
Messages
6,195
It should only load one form, thus in your case, make it visible. Is there a reason you do not close the form instead of making it not visible?

The below will test if form "fA" is open...

Function IsFormOpen(strFormName As String) As Boolean
IsFormOpen = (SysCmd(acSysCmdGetObjectState, acForm, strFormName) = acObjStateOpen)
End Function

Private Sub Command1_Click()

If IsFormOpen("fA") = True Then
MsgBox "Form A is open"
Else
MsgBox "Form A is not open"
End If

End Sub

HTH
 

L4serK!LL

Registered User.
Local time
Today, 21:07
Joined
Jul 22, 2002
Messages
59
ghudson said:
It should only load one form, thus in your case, make it visible. Is there a reason you do not close the form instead of making it not visible?
Just performancy reasons, making visible again is much faster than reloading from zero...

Does it make a difference if you actually OPEN a invisible form or MAKE VISIBLE (the same invisble form)...?
 

Users who are viewing this thread

Top Bottom