Problem making a label visible in subform! Continue of previous post! Please help!

maisam

Registered User.
Local time
Today, 07:30
Joined
Oct 25, 2005
Messages
15
I sent a post earlier today about making a label visible in a subform! I am still working on it but still no progress!

I have a different scenario (its the same thing but trying to explain the method i'm working on):

I have one main form (frmMain) that contains 3 subforms, say subfrm1, subfrm2 and subfrm3. On Open only 1 is visible and 2 and 3 are invisible (however they are open and loaded).

By choosing an option on 1 subfrm2 becomes available! When choosing an option on subfrm1 a boolean called 'XXX' is set to true. Now i want one particular label to become visible in subfrm2 if 'XXX' is true! To do this i need to write a code to be executed when subfrm2 is appears on screen! The problem is this form is already open so how and on which event of subfrm2 can i write the code???

At the moment i'm trying to refresh subfrm2 (by using code in subfrm1) and I have placed my code on the On Load event of subfrm2. I thought this way the form will reload and the On Loand event will pick up the new value for boolean XXX and set the label to visible! Thats the idea anyway... here is the code i have in subfrm1:

Code:
XXX = True

Forms![frmMain].subfrm2.Form.Refresh

subfrm1.Visible = False

subfrm2.Visible = True

I'm not sure if refreshing the subform will result in On Load event to be executed! And i'm not even sure that the code for refreshing subfrm2 is correct. Can any1 help me with this?

I have attached the actual database on my previous post sent today, if you prefer to look at the whole thing and get a feel of the problem!
 
Using your example:
Code:
XXX = True

Forms![frmMain].subfrm2.Form.Refresh

subfrm1.Visible = False

subfrm2.Visible = True
If XXX = True Then
   Me.subfrm2.Form!Label1.Visible = True
End If
If executed from frmMain. Setting a SubFormControl visible does not activate any event on the SubForm. You need to do it in the same code that makes the SubForm visible.
 

Users who are viewing this thread

Back
Top Bottom