Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay I am suffering from the process of migrating from XP to 2007.

    I have a main form that has multiple subforms that are hidden on loading in the main form's load event. I have set all forms with the visible property set to False using Me.frmLearners.Visible = False.

    I then have a series of buttons that changes the visible property either False or True. I save the VBA editor and reload the frmMain but clicking the button does not make the form visible.

    The click event looks like this

    Private Sub cmdLearners_Click()
    Me.frmClasses.Visible = False
    Me.frmLearners.Visible = True
    End Sub

    I would expect that the frmLearners would be visible. But it isn't.

    Thanks for any help.

    Fay

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Have you dealt with the Trusted Locations issue?

    Office button...Access Options..Trust Centre..Trust Centre Settings...Trusted Locations..Add New Location

    In Access 2007 code does not execute unless the db is in a trusted location.
    Regards
    John



  3. #3
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Fay,

    Here's some code I use with a different syntax maybe that will work for your.
    Code:
    '                            +--------------------+               +----------+
    '----------------------------|cmdShowDocks_Click()|---------------| 06/05/10 |
    '                            +--------------------+               +----------+
    'Called by: Show Docks Buton on frmOwnerInput
    'Calls    : N/A
    
    Private Sub cmdShowDocks_Click()
    
       With Forms![frmAssignDocks]
    
         If .Visible Then
           .Visible = False
           Me.cmdShowDocks.Caption = "Show Docks"
         Else
           .Visible = True
           Me.cmdShowDocks.Caption = "Hide Docks"
         End If
         
       End With
       
    End Sub                      'cmdShowDocks()
    I do need to note that this opens a second form not a sub form but the syntax should work for a sub form, i.e.,,
    Forms![frmClasses].Visible
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  4. #4
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No I didn't know anything about it. Thanks.

    Unfortunately it didn't make it work.

    Fay

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Are you sure that the code actually executes? (I can't see anything wrong with the code.)

    A message box is one way to test.

    Code:
    Private Sub cmdLearners_Click()
    msgbox "Learners"
    Me.frmClasses.Visible = False
    Me.frmLearners.Visible = True
    End Sub
    Regards
    John



  6. #6
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The message box displays as you would expect.

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

    Are you sure that frmLeaners is the name of the subform control.
    When you put a subform within another form, the subform is placed within a subform control.

    Usually the subform control has the same name as the form within it, but not always.

    In the Properties box, the name is on the Other tab. The Source Object on the Data tab tells you the name of the form displayed within the control.
    Regards
    John



  8. #8
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I wasn't able to get the code that RetiredGeek offered. I am really getting frustrated.

    Here is my code for the main form and the buttons on it.
    The visible property on the property sheet is set to yes. I have changed it to know and tested it with success.

    Option Compare Database
    Private Sub cmdClasses_Click()
    Me.frmCE.Visible = False
    Me.frmClasses.Visible = True
    Me.frmLearner.Visible = False
    Me.frmMaintenance.Visible = False
    Me.frmProviderUnit.Visible = False
    Me.frmRegistration.Visible = False
    Me.frmReports.Visible = False
    Me.frmResources.Visible = False
    End Sub
    Private Sub cmdLearners_Click()
    Me.frmCE.Visible = False
    Me.frmClasses.Visible = False
    Me.frmLearner.Visible = True
    Me.frmMaintenance.Visible = False
    Me.frmProviderUnit.Visible = False
    Me.frmRegistration.Visible = False
    Me.frmReports.Visible = False
    Me.frmResources.Visible = False
    End Sub

    Private Sub cmdMaintenance_Click()
    Me.frmCE.Visible = False
    Me.frmClasses.Visible = False
    Me.frmLearner.Visible = False
    Me.frmMaintenance.Visible = True
    Me.frmProviderUnit.Visible = False
    Me.frmRegistration.Visible = False
    Me.frmReports.Visible = False
    Me.frmResources.Visible = False
    End Sub

    Private Sub Form_Load()
    Me.frmCE.Visible = False
    Me.frmClasses.Visible = False
    Me.frmLearner.Visible = True
    Me.frmMaintenance.Visible = True
    Me.frmProviderUnit.Visible = False
    Me.frmRegistration.Visible = False
    Me.frmReports.Visible = False
    Me.frmResources.Visible = False
    End Sub

  9. #9
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I let the computer completed the coding. I typed Me.frm and the options for the various forms were displayed and I was able to select it.

  10. #10
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Is this all something that has worked previously in an early version of Access, and now does not work with 2007? Or are you building this in 2007? (I think you have answered that now.)
    I can't see anything wrong with your code.

    If you use a Tab Control and put the subforms on different pages, you achieve the same result without the need for any code.
    Regards
    John



  11. #11
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was redeveloping the database to make it better. But I used the coding that I used before and I am getting no where.

  12. #12
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Can you post something for us to have a look at? Import just the bare minimum into a new database, remove any confidential data, and zip it.

    I still can't see anything wrong with the code.
    Regards
    John



  13. #13
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried to send it as a zipx file (latest version of winzip) and got a message that it was an illegal file type. This was after I tried to send the basic file without zipping. I got the same illegal file message.

    I just brought in the older version of the database, changed the Trust settings as instructed earlier. The tab control pages work on the main form. But...
    None of the buttons work.

    Is there some type of control in Access options that would make buttons inoperable?

    Can I send it to you via email?

    Thanks for hanging with me. I really need to get this fixed so I can get this database developed.

    Fay

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

    I have sent you a PM with my email address so you can send it directly.

    I can't think of anything else in Access that makes the buttons not operate.
    Regards
    John



  15. #15
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Go ahead and send it to fay@awarenessproductions.com
    I haven't seen the PM come in. So try this address.

Page 1 of 2 12 LastLast

Posting Permissions

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