Results 1 to 7 of 7
  1. #1
    fhickler is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2018
    Posts
    30

    Refresh unbound table


    Is there a way to click a button on an unbound form and have it execute the eqivalent of the refresh command on an unbound table? I anticipate people saying that this is bad practice, or ask for more details in order to advise me of a different way to do it. But first I want to find out if this is possible and if so, what the code or macro would be that would be that would be associated with the button.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    the way you refresh a form is

    me.requery
    alternatively
    me.refresh, me.recalc or me.repaint

    whether one of these will do what you want, I wouldn't know, try them and see

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    What are you doing on your unbound form?

    If, when you open your form, it is displaying the values relating to a specific record and someone subsequent to your opening the record changes the data and you want to refresh the page to see if the information is still current, then yes, you just call the 'on open' event of the form from a button click and it should repopulate the form.

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    If a form is unbound, some action (VBA or macro) must be taken to retrieve data from a table to display on the form. A refresh or requery emulation for such a form would simply require a button for example, to run the code that populates the form.

  5. #5
    fhickler is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2018
    Posts
    30
    I think I figured it out. Basically I have a form with a button that, when clicked, writes some data to a separate table via VBA. The form and table have no relationship other than that. So I want the table to refresh everytime the button is clicked so I don't have to manually. I found a code snippet that seems to work:

    DoCmd.SelectObject acTable, "tblAudit"
    DoCmd.Requery

    Thanks for trying to answer my not very detailed question.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,412
    Ah, so you wanted the data to show everywhere else once the unbound form updated the table...
    Glad you figured it out.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is the table open or something? It doesn't make any sense to requery the table otherwise; you'd requery the form/report displaying its data. If the table is open, I'll point out that most of us do not let users into tables or queries directly, only forms and reports. You have little control over what they do otherwise.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 8
    Last Post: 08-30-2015, 02:54 PM
  2. refresh interval & unbound form
    By vientito in forum Programming
    Replies: 6
    Last Post: 11-11-2014, 11:31 AM
  3. Refresh a table using code
    By john134 in forum Programming
    Replies: 2
    Last Post: 01-22-2014, 07:04 PM
  4. Replies: 1
    Last Post: 07-13-2012, 09:13 AM
  5. update imported table like a refresh
    By cmul in forum Access
    Replies: 1
    Last Post: 09-02-2010, 09:28 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