Results 1 to 13 of 13
  1. #1
    CodeLiftSleep is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    48

    Form stops updating after a few clicks

    I have a form on which I have 2 reports that are the exact same size and the same location that I allow users to toggle back and forth between by pressing a toggle button by changing the visible properties on the two reports(when one is visible, the other is not)

    It works fine to toggle the first time and then toggle back, but then it stops working.

    I put the break points in the code and the click event is being triggered, but the form doesn't update. The toggle button caption should change from "Click to View Client Reports" to "Click to View Manager Reports" and vice versa, but this isn't even functioning. It's almost like the form is frozen.

    I tried Me.Repaint and that didn't work. Me.Refresh does work, but it starts the form over again at the default setting so I can't really use it because the toggle will never work.



    Any help here? Why isn't the form updating after a few toggles?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Post your toggle button code.

    Maybe instead of two container controls and setting Visible property, try one container and set its SourceObject property. This is basically what a Navigation form does. I don't usually recommend Navigation form but maybe it would be suitable for your situation. Depends what else is going on with this form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    CodeLiftSleep is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    48
    Quote Originally Posted by June7 View Post
    Post your toggle button code.

    Maybe instead of two container controls and setting Visible property, try one container and set its SourceObject property. This is basically what a Navigation form does. I don't usually recommend Navigation form but maybe it would be suitable for your situation. Depends what else is going on with this form.
    Code:
    'This button toggles the report view
    Private Sub ToggleReportView_Click()
        Dim strName As String
        strName = Trim(Me.ToggleReportView.Caption)
        If loggedUser.IsManager = True Then
            If InStr(strName, "Client") Then
     ' We are going to switch to Manager Reports
                Me.ToggleReportView.Caption = "     Click To View      Manager Reports"
                Me.MgrScorecardSummary.Visible = False
                Me.ClientScoreCard.Visible = True
            Else
                Me.Caption = "    Click To View     Client Reports"
                Me.MgrScorecardSummary.Visible = True
                Me.ClientScoreCard.Visible = False
            End If
        Else
            MsgBox "Error! This button should not be visible! Please send a screenshot of this error to:" & vbCrLf & vbCrLf & _
            "Email: xxxxx&xxx.com" & vbCrLf & _
            "Error:  ToggleDetailsBtn Visible when it should not be" & vbCrLf & _
            "Location: Form2", vbOKOnly, "Please report this error!"
        End If
    End Sub

  4. #4
    CodeLiftSleep is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    48
    OMG!! What an idiot I am...

    I had
    Me.Caption instead of Me.ToggleButtonView.Caption...no wonder why the name at the top of the tab kept changing, lol...

    Uggh...long day. Works perfectly now...to check what you were saying I tested it by changing the sourceobject of a subform with the click also and that works too...

  5. #5
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I think your problem is here
    Me.Caption = " Click To View Client Reports"
    Should it be Me.ToggleReportView.Caption because Me refers to the form? You are trying to set the form's caption. Why this should interrupt the visibility of the other objects is beyond me, but that's what happened when I tested your code. Your code could probably be condensed - curious that you assign strName a value, but don't seem to use the variable. I was going to point out that here are 2 others like that, but I see you commented them out.
    Last edited by Micron; 07-28-2017 at 05:08 PM. Reason: added info
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Or put the reports on different pages of Tab control and no VBA is needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Quote Originally Posted by June7 View Post
    Or put the reports on different pages of Tab control and no VBA is needed.
    Even better! (except vba to restrict viewing as in original code).

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    So non-managers are allowed to open this form, just not view everything on it? Pages of Tab control can be set not visible depending on user category, however, at least 1 page must remain visible.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    But the control doesn't have to be visible if some users shouldn't see any of the tabs. OP has a few options to consider now, so I think I'll wait since I don't think we really know the exact situation.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    CodeLiftSleep is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    48
    Quote Originally Posted by June7 View Post
    So non-managers are allowed to open this form, just not view everything on it? Pages of Tab control can be set not visible depending on user category, however, at least 1 page must remain visible.
    Basically there are 3 types of people who will be viewing these: Employees, Managers and Admins

    Employees should only see their information(controlled by their employeeID) and not either of the other forms(managerScorecard and clientScorecard)

    Managers should be able to see the managerScorecard and clientScorecard but not the employeeScorecard. The toggleButton switches between the two scorecards they are able to see.
    Admins are able to see everything

    the loggedUser object has several properties, but the checks done for these are loggedUser.IsManager and loggedUser.IsAdmin---if both are false its an employee.

    I've learned quite a bit over the last month or so, this is my first major project in Access(for work) so I probably would do some things differently if I was starting over again, but although it likely isn't the best way to have this working(when I get time to write the second version of this it will be on SharePoint using HTML, Angular and JS to pull the data from Access and display it on screen without them ever touching Access), it does work fine for our purposes and there is no real time for me to go back and do a major re-design, as I have a multitude of other projects lined up with more and more of a backlog growing each day.

  11. #11
    Join Date
    Apr 2017
    Posts
    1,792
    Quote Originally Posted by CodeLiftSleep View Post
    when I get time to write the second version of this it will be on SharePoint using HTML, Angular and JS to pull the data from Access and display it on screen without them ever touching Access
    Access is great tool to create user interface, but quite medicore as database. I myself convert my older projects to MS SQL databases lately, and new ones are all MS SQL databases with Access application as front-end (or excel tables for users, when no data entry from user is needed and the main output must be graphical).

  12. #12
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    The user object logic is a bit flawed, sorry to say. The property should be like Level with user and admin as 2 possibilities. If you had to add guest, for example, you are beat. The right approach is to correctly identify a property then define it's values. The property in this case is level, permissions as examples, with text or number values. A property is seldom (if ever) Boolean in nature, although its values might be. I once had a db become in demand by upper management and it was easy to add a property value because the property was correctly defined. Always consider the possibility of expansion in all aspects. If expansion demands redesign, you might have designed inefficiently.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    CodeLiftSleep is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    48
    Quote Originally Posted by Micron View Post
    The user object logic is a bit flawed, sorry to say. The property should be like Level with user and admin as 2 possibilities. If you had to add guest, for example, you are beat. The right approach is to correctly identify a property then define it's values. The property in this case is level, permissions as examples, with text or number values. A property is seldom (if ever) Boolean in nature, although its values might be. I once had a db become in demand by upper management and it was easy to add a property value because the property was correctly defined. Always consider the possibility of expansion in all aspects. If expansion demands redesign, you might have designed inefficiently.
    You are right.

    It's funny because at my last job I designed something similar to that using an Enum where we could just add to the Enum as needed.

    Goign to go change this..sometimes when you are in the forest, you can't see the clearing right in front of your face...

    Thanks for reminding me about proper coding procedures...I needed that one.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using less screens and clicks.
    By JoshuaEir in forum Forms
    Replies: 11
    Last Post: 03-05-2015, 01:09 PM
  2. Replies: 3
    Last Post: 01-15-2015, 12:23 PM
  3. Replies: 5
    Last Post: 11-26-2013, 09:20 AM
  4. Replies: 4
    Last Post: 06-01-2013, 11:32 PM
  5. Form Stops Updating Subforms
    By caddcop in forum Forms
    Replies: 1
    Last Post: 04-06-2011, 08:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums