Results 1 to 7 of 7
  1. #1
    jnoonan22 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12

    Question Auto Refresh - ReApply Filter

    My initial form is a datasheet with a list of invoices which was filtered on open to include only invoices pertaining to a specific project. Clicking on an invoice opens the invoice detailed input form where data can be edited in dialog. Clicking on the "new/blank" line opens the invoice detailed input form for adding data in dialog.

    After adding a new invoice in the detailed input form, I save and close that which takes me back to the datasheet parent form I initially clicked on. I cannot for the life of me figure out how to have that form re-apply the filter so that the new invoice just created shows up in the list of invoices. If I manually unclick and re-click the filter icon at the bottom, it will appear, but I can't get the form to do this automatically. I've tried "on focus", "on activate", and several other events to try and get this to happen, but for some reason closing out the detailed form (which I thought automatically returned focus to the datasheet form) does not trigger an event.

    The only way I have been able to make this somewhat work is by having the datasheet form close out when focus shifts to the new form, then reopen the datasheet form when I close the detailed input form, which of course re-filters the data to now include the new info. This however seems excessive; there has to be a cleaner way to simply re-filter the datasheet form by simply closing out the input form...right? Thanks in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    What is the code that opens the detail input form? Open the form in Dialog mode and code execution by the main form will be suspended until the detail form closes.

    What I do:

    DoCmd.OpenForm "formname", , , , , acDialog
    Me.Requery
    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
    jnoonan22 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12
    Well I tried using your code but I must be doing something wrong. All my macros and events have been setup using the macrobuilder. I deleted my current openform macro and recreated using your code:
    Private Sub INVOICE_NUMBER_Click()
    DoCmd.OpenForm "formPROJECT REVENUES", , "ProjectID", "[PROJECT]='" & [PROJECT] & "'", acFormEdit, acDialog
    Me.Requery
    End Sub

    Now when I click on my field, nothing happens; the form doesn't even open. Sorry, I've never written procedures for Access directly as code so I'm sure I've missed some things.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Try without "ProjectID" in the FilterName property. I've never used the FilterName argument, only the WhereCondition.

    The WhereCondition should probably use ProjectID.

    "ProjectID=" & Me!ProjectID
    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.

  5. #5
    jnoonan22 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12
    Okay thanks! I had to go into my database options and enable content for the script to execute apparently. That's really frustrating i had no idea the script wasn't even executing. The code executes perfectly now and refreshes just as i intended. Thanks for the help!

  6. #6
    jnoonan22 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    12
    I have another form I'm trying to accomplish something similar on, only I'm refreshing the dsum function behind the field rather than requerying. I'm employing the dialog format which worked as you previously mentioned, but when i debug the execution it continues to execute and refresh the field regardless of the fact that a new form opened in dialog mode, so it doesn't refresh after i've input data in the newly opened form like i intended for it to. Why does the prior situation you helped me resolve freeze the code execution until the dialog is closed but not the new refresh code? Thanks again for your help, i appreciate it!

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Don't think I've ever had a domain aggregate function in those circumstances. The DSum is in a textbox? Well, that isn't VBA so it is not influenced by the acDialog.
    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.

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

Similar Threads

  1. Replies: 7
    Last Post: 06-27-2013, 10:56 AM
  2. Replies: 4
    Last Post: 07-08-2012, 10:49 AM
  3. Macro to Auto Filter
    By skinny1434 in forum Access
    Replies: 1
    Last Post: 06-14-2012, 01:13 PM
  4. auto refresh the table content
    By mohammad8065 in forum Access
    Replies: 1
    Last Post: 02-27-2012, 01:54 PM
  5. Access 2010 Refresh VS Refresh ALL
    By Snwboarder1982 in forum Access
    Replies: 1
    Last Post: 09-09-2011, 04:07 PM

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