PDA

View Full Version : Automatic refresh/Requery



newbie83
04-10-2015, 06:08 AM
Hi All,

i have a db with 2 tables a query and a form, my question, is it possible to have a button within the form that when clicked would do the same as me manually opening each table/query and pressing refresh all?

i have tried Me.Refresh and Me.Requery this just seems to refresh/requery the form itself not the tables and query.

any help would be greatly appreciated.

Thank you in advance.

jonh
04-10-2015, 07:31 AM
DoCmd.SelectObject acTable, "table1"
DoCmd.Requery

DoCmd.SelectObject acQuery, "query1"
DoCmd.Requery

newbie83
04-10-2015, 08:09 AM
Hi Jonh,

Thank you that works a treat. just one more quick question i noticed that the table and query need to be open for the button to work, is it at all possible for it to work while the table and query are closed ?

jonh
04-10-2015, 09:28 AM
I guess you mean the code errors if the objects are closed.
Just add 'on error resume next' at the start of the procedure.