• Form visibility problem in Access 2007

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Form visibility problem in Access 2007

    Author
    Topic
    #472910

    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

    Viewing 16 reply threads
    Author
    Replies
    • #1254285

      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.

    • #1254287

      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!
      Computer Specs

    • #1254288

      No I didn’t know anything about it. Thanks.

      Unfortunately it didn’t make it work.

      Fay

    • #1254289

      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
      
    • #1254290

      The message box displays as you would expect.

    • #1254293

      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.

    • #1254295

      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

    • #1254296

      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.

    • #1254297

      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.

    • #1254298

      I was redeveloping the database to make it better. But I used the coding that I used before and I am getting no where.

    • #1254300

      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.

    • #1254302

      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

    • #1254305

      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.

    • #1254306

      Go ahead and send it to fay@awarenessproductions.com
      I haven’t seen the PM come in. So try this address.

    • #1254308

      You have set the Visible Property of the Details section to No. All the subforms are within that, so you still don’t see them, even when their own Visible property is true.

    • #1254309

      Bless you. That was it. Thanks for hanging in there with me. Fay

    • #1254310

      Glad we got there in the end.

      You can create ordinary Zip files using Right Click…Send to …Compressed (zipped) folder.

    Viewing 16 reply threads
    Reply To: Form visibility problem in Access 2007

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: