Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've confused (normally am).

    I have a main form that houses 3 option groups. Each object, when selected, will set the criteria for a query. The third option group (fme_Goal_Options) has 4 options in it, Add, Close, Remove and Edit.

    Also on this form is a tabbed form with 3 tabs and each tab has a subform.

    One of the subforms (sfrm_Edit_Goals_Outcome) has an Option Group (fme_Edit) with 2 options, opt_Edit1 (Remove) and opt_Edit2 (Edit) with visible properties set to FALSE. Both Remove and Edit have different procedures.

    Here's my problem:

    On the main form, in the 3rd option group (fme_Goal_Options), if the user selects either the 3rd option (Remove) or the 4th option (Edit), sfrm_Edit_Goals_Outcome visible=TRUE and gets the focus.

    What should happen next is:

    If the user selects the REMOVE option, fme_Edit and opt_Edit1 visible=TRUE allowing the user to select it.
    If the user selects the EDIT option, fme_Edit and opt_Edit2 visible=TRUE allowing the user to select it.

    I have the following code in the AfterUpdate Event of fme_Goal_Options:
    Code:
    TabCt.Visible = True
    Select Case fme_Goal_Options
    	Case 1 'Add a Goal
    		Me.pgGoals.Visible = True
    	Case 2 'Close a Goal
    		Me.pgSelectedGoals.Visible = True
    		sfrm_Selected_Goals.SetFocus
    	Case 3 'Remove a Goal
    		txtER = 1
    		pgSelectedOutcomes.Visible = True
    		pgSelectedOutcomes.Caption = "Remove Goal"
    		pgSelectedOutcomes.SetFocus
    		sfrm_Edit_Goals_Outcome.Visible = True
    		sfrm_Edit_Goals_Outcome.SetFocus
    	Case 4 'Edit a goal
    		txtER = 2
    		pgSelectedOutcomes.Visible = True
    		pgSelectedOutcomes.Caption = "Edit Goal"
    		pgSelectedOutcomes.SetFocus
    		sfrm_Edit_Goals_Outcome.Visible = True
    		sfrm_Edit_Goals_Outcome.SetFocus
    End Select
    In the OnLoad Event of sfrm_Edit_Goals_Outcome, I have the following code:
    Code:
    If Forms!frm_Goal_Information.txtER = 1 Then 'True=Remove
    	For Each ctr In Me.Controls
    		If ctr.Tag = "Remove" Then ctr.Visible = False
    		If ctr.Tag = "Edit" Then ctr.Visible = True
    	Next ctr
    Else
    	For Each ctr In Me.Controls
    		If ctr.Tag = "Edit" Then ctr.Visible = False
    		If ctr.Tag = "Remove" Then ctr.Visible = True
    	Next ctr
    End If
    The problem is, fme_Edit and its 2 options as don't change as they should based on the code above. i.e. if Remove is selected, then opt_Edit1 should be visible, if EDIT was selected, then opt_Edit2, should be visible.

    Could someone please take a look at it and let me know what I've done wrong.

    I really appreciate any assistance on this.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The On Load event of the subform does not occur when it is made visible, but when the main form is loaded, whether the subform is visible or not. So the code you wrote is not executed when the subform is made visible.
    You'll have to show/hide controls on the subform from your main form code.

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='786091' date='24-Jul-2009 14:51']The On Load event of the subform does not occur when it is made visible, but when the main form is loaded, whether the subform is visible or not. So the code you wrote is not executed when the subform is made visible.
    You'll have to show/hide controls on the subform from your main form code.[/quote]

    Thanks Hans,

    That did the trick. Much appreciated.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Glad that just a hint was enough. Good for you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •