Results 1 to 13 of 13
  1. #1
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subform.visible (but isnt?) (2000)

    I know, I know, quite a sudden barrage of problems, but until tonight, I've been leaving well enough alone, and working on some CCNA/CCNP classes. Tonight, since I'm all routered out, I switched my focus back to my database.

    My form has two subforms that alternate being hidden/visible. When my form is opened, my main subform shows just fine. My problem is that when I click the toggle button to hide subform 1 and display subform 2, subform 1 is hidden and subform 2 remains hidden....until I change the focus of my main form to another record. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subform.visible (but isnt?) (2000)

    Can you post the code you're using (or a stripped down copy of the database)?

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform.visible (but isnt?) (2000)

    Hans,
    I believe I may have overly-normalized my database, as all separate information groups are stored in separate tables, and each subform relates to only one table. Posting a stripped down copy requires some work. Hopefully this will help: The code segment is on my toggle button that *should* show my second form. Like I said before, the subform is visible after I change the focus to another record, so I'm not sure what's causing the error. All subforms are (by default) set to Visible = No, except sfrmS1 (my main form).

    _________________________________________
    Private Sub tglBasicInfo_Click()
    If tglBasicInfo = True Then
    tglPersonalInfo = False
    tglAddressInfo = False
    tglShowS1 = False
    tglTrain = False
    tglMCI = False
    tglPromo = False
    sfrmProCon.Visible = False
    sfrmCompositeScore.Visible = False
    sfrmTraining.Visible = False
    sfrmS1.Visible = False
    sfrmAddresses.Visible = False
    sfrmPersonalInfo.Visible = False
    sfrmBasicInfo.Visible = True
    sfrmMCI.Visible = False
    Else
    sfrmBasicInfo.Visible = False
    End If
    End Sub
    ______________________________
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subform.visible (but isnt?) (2000)

    Hard to say without seeing the database, but perhaps you should set
    sfrmBasicInfo.Visible = True
    before hiding all the others.

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform.visible (but isnt?) (2000)

    No dice. How do I set the focus of the form on the first record in my listbox on that form? Maybe that'll alleviate the problem...I realize that Me!lstNames.SetFocus will set the focus on the list box, but how do I select the first record?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subform.visible (but isnt?) (2000)

    Do you mean that you want to select the first item in the list box?

    Me.lstNames.Selected(0) = True

  7. #7
    2 Star Lounger
    Join Date
    Mar 2005
    Location
    Anderson, Indiana, USA
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform.visible (but isnt?) (2000)

    Jeremy,

    DoCmd.GoToRecord , , acFirst

    Try adding this on the event to go to the first record based on the form its self. Also you could try to do a Me.Refresh after setting the visibility to true.

    If you mean selecting the first choice in the list box then use
    Me.lstNames.Selected(0) = True


    Winston

  8. #8
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform.visible (but isnt?) (2000)

    Winston,
    <img src=/S/hello.gif border=0 alt=hello width=25 height=29>! Thanks for the advice. I tried:
    DoCmd.GoToRecord , , acFirst

    However, still, no dice. If I use

    Me!List53.Selected(1) = True

    it works swimmingly. I think it may have something to do with the control source of the main form.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  9. #9
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Subform.visible (but isnt?) (2000)

    From the look of this you have a number of subforms, and you are showing/hiding them with some toggle buttons.

    Why not just use a tabbed control with each subform on a separate page. It achieves the same result without you having to do any coding yourself.

    If all you want to do is show/hide subforms, why do you want to set the focus back to a list box, and to a particular item in the list box? Isn't this going to switch you to a different record?
    Regards
    John



  10. #10
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subform.visible (but isnt?) (2000)

    Jeremy

    Tab Controls could be an option!

    Maybe it would be an idea to review your code, I can see it can get a bit confusing.

    Have you thought about using:

    If expression Then

    statements

    ElseIf expression-n Then

    elseifstatements

    Else

    elsestatements

    End If

    It will give you the opportunity to then put each item that you want to hide/unhide and set focus into smaller partitions and help with the logic. My <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15> worth
    Jerry

  11. #11
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Jacksonville,NC, USA
    Posts
    705
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform.visible (but isnt?) (2000)

    Hi again, just checking the boards for my own answers [img]/forums/images/smilies/smile.gif[/img] and seen your post...hope all is well with you.

    I agree with the TABs for subforms...does make it easier. Look on your Toolbox toolbar for the TAB control button and then click your form, wherever you wish. What I don't know is if there is a limit to the pages, but I've never heard of any.

    Nannette Padgett
    NMP <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

    If you can't convince them, confuse them. - Harry Truman <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Subform.visible (but isnt?) (2000)

    If there is a theoretical limit to the number of tabbed pages, it is much higher than the practical limit: a form can contain no more than 754 controls during its entire lifetime, so if you created a tab control with 1,000 pages (which is possible), you wouldn't be able to populate all of them! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  13. #13
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subform.visible (but isnt?) (2000)

    When I originally designed this form, I had planned to use tabs. However, when trying to create them, I got an error, and wasn't in the position to try to reinstall any or all of access. I am redesigning this form now, (I just received my personal laptop, with Office XP installed), and hopefully things will go better this time around. Most of the hard stuff is done (the designing of the subforms, coding the filter boxes, etc) so it shouldn't take long. Thanks for all your help.

    Nannette, I hope all is well back in the states - - are you still teaching at CCCC? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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