Refresh Query Issue
Results 1 to 2 of 2

Thread: Refresh Query Issue
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Aug 2007
    NJ, USA
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default Refresh Query Issue

    I have the below code on frmDashboard. When I click on cmdAddEmployee, I'm directed to frmAddEmployee and when finished and close, frmDashboard updates the list of Employees and goes to the latest record.

    The below code works however, I've noticed an issue that when exiting out of this database, msaccess.exe is still running. I have to consistently end that task and then I can reopen the database successfully.

    I've commented the below code out and then did not experience the issue above with msaccess.exe still running. Is there something wrong with my code below?

    Private Sub Form_Activate()
    'Refresh Employees displayed on Dashboard form by Last Record
        Dim rs As Recordset
        If DCount("*", "qryDashboardEmployees", [ID]) > 0 Then
            Set rs = Me.RecordsetClone
            rs.FindFirst "id=dmax('ID', 'tblEmployees')"
            Me.Bookmark = rs.Bookmark
        End If
    End Sub

  2. #2
    Board Regular
    Join Date
    Jun 2015
    Ontario, Canada
    Post Thanks / Like
    1 Post(s)
    0 Thread(s)

    Default Re: Refresh Query Issue

    Likely this is firing since commenting it out has eliminated the problem (we think). I say likely because there are no other clues as to how the exit process happens, only that frmAddEmployee closes, which does not fire this event. The form has to get the focus for this to fire, so that may not be happening until you click a form command button to exit? I would add msgbox "Query all done" before End If and msgbox "Query didn't run" so you can see exactly when this fires and whether or not the query runs. You may be attempting to exit while this sub is running, although I'd have thought you'd get a system prompt of some sort.
    A better way for what you're doing might be to set your dashboard form bookmark as the last operation in your frmAddEmployee, or set the focus to a control on this form as the last operation (easier) and the event should fire with Forms!frmFormNameHere.ControlNameHere.SetFocus.
    Last edited by Micron; Jan 5th, 2016 at 12:17 AM.
    Tips for posting problems:
    1) "doesn't work" doesn't help. Post error message text/numbers and/or state what's happening.
    2) if posting code or sql, use code tags; specify on which code line errors occur, if applicable
    3) try to be specific; assume we know nothing about your issue - because we don't!

    Make all suggested changes in copies of your database or to its objects.

    "1 out of 1010 people understand binary. The other 1001 don't."

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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