Refresh a local table view after delete all record then append with out the F5

Rx_

Nothing In Moderation
Local time
Today, 15:03
Joined
Oct 22, 2009
Messages
2,803
Right now, the local table must be selected and the F5 clicked to see the result
Trying to automate the F5 refresh

A local table is used to evaluate many records in a process.
When a 2nd list box item is selected, there is vba code that
1 Deletes all records in MyLocalTable
2 Repopulates with new records from a VBA Append query
3 Runs analysis updating a Status field in MyLocalTable

When testing, the Form is open in run mode with the local table open just above it.
After the form clicks, the table must be highlighted - this replaces all of the old data with <delete>
Then the F5 is pressed

Is there vba code to take the place of the F5
Will it work if the table is not actually open (visible)
 
Thanks, that does not work.
 
This at least causes the old records to show as #Deleted AND
it automatically updates the OPEN TABLE!!!
No error if table is closed.

Dim acIsDeficientInRefreshingOpenTableAs Long
acIsDeficientInRefreshingOpenTable= acTable
DoCmd.SelectObject acIsDeficientInRefreshingOpenTable, "MyOpenTableName"
DoCmd.Requery ' this refreshed the table!!

(Access 2013)

Without this code, the old values stay there after an Execute delete all records and after an Execute append SQL statement.
CurrentDb.Execute "DELETE FROM MyOpenTableName;", dbFailOnError + dbSeeChanges 'Clear local table
CurrentDb.Execute strSQLAppendQuery, dbFailOnError + dbSeeChanges 'repopulate same local table

The open table during run-time is just for developer testing.

Read an old, old post where Bob Larson said the table couldn't be refreshed.
My example ran on Access 2013 - please report results if not Access 2013.
Bob had a stellar record, perhaps this is an update.

Yes... I do see into the future!
I was editing the response and testing my code without the table being open.
It works fine JDraw. Leave the last parameter blank - it will default to 0 according to the MSDN example for Forms.
 
Last edited:
If you try a test run without the table open, what happens?
 
  • Like
Reactions: Rx_

Users who are viewing this thread

Back
Top Bottom