Results 1 to 3 of 3
  1. #1
    tonygg is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    115

    Refreshing a Cross tab Query Form on Close of a Pop up Form

    Hi. Not sure if I am explaining it correctly but...



    I have a cross tab query with the results in a datasheet view style form. It has simple conditional formatting on some columns. If I double click a field on the datasheet I get a new form that I can use to update data (directly in the DB) that is displayed in the cross tab datasheet. On close of that data entry form I want to see the updated data (no additions, just value changes) displayed in the crosstab query.

    I have tried using the Me.Form.Requery on my main datasheet and made the other form (TONY PRODUCT PERMS FORM) modal:

    Private Sub Product_Reference_DblClick(Cancel As Integer)
    Dim ProductRefText As String
    ProductRefText = Me.Product_Reference.Value
    DoCmd.OpenForm "TONY PRODUCT PERMS FORM", OpenArgs:=ProductRefText
    Me.Form.Requery
    End Sub

    This seems to refresh the sheet before I have updated the data. It also puts the curser back to the top of the datasheet rather than the row I double clicked on.

    The form can be closed by either the x on Top RHS or custom cancel or update button s. Ideally I would like the refresh to occur only when I use the "update and close" button in the data entry form.

    Any ideas to be able to do this and retain the position in the datasheet form would be gratefully received. Many Thanks

    Any help on getting the refresh to happen

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    This should help:

    http://www.baldyweb.com/Requery.htm

    Also, use the acDialog argument in the window mode and the code will wait for the popup form to be closed or hidden. Or you can perform the requery from the close event of the popup form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tonygg is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    115
    Thank you. I hadn't thought of putting it in the close event. That now refreshes correctly.

    Still a bit stuck on getting back to the correct row in the cross tab datasheet form. I didn't really understand (sorry) you code with book marks.

    I pass the unique value in the first column of the datasheet to the pop up form so I have that available on close. I was wondering if there a way of using it to put the cursor back to that row? Something like Excel Active.Row or Field (x,y) command?

    The other thing I noticed is whilst I can set focus on a field in the pop up so the cursor is on it for data entry the mouse does not always move onto the form. Would you happen to know if there is a command to do that?

    Thanks once again

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

Similar Threads

  1. Replies: 4
    Last Post: 10-09-2014, 07:09 PM
  2. Replies: 23
    Last Post: 07-05-2014, 08:13 AM
  3. Replies: 4
    Last Post: 01-31-2014, 11:47 AM
  4. Replies: 2
    Last Post: 06-20-2011, 03:10 PM
  5. refreshing form after running query
    By ninachopper in forum Queries
    Replies: 1
    Last Post: 07-12-2010, 04:30 AM

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