By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,164 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,164 IT Pros & Developers. It's quick & easy.

Deleting records from table

P: 25
I'm trying to delete records from a table. Part of this table is displayed in a form (subform)

DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE Temp.* FROM Temp"
DoCmd.SetWarnings True


After deleting the records, all the cells are filled with the value #Deleted.
Only when i reopen the form then would the #Deleted value be gone.
Sep 5 '07 #1
Share this Question
Share on Google+
3 Replies


BradHodge
Expert 100+
P: 166
I'm trying to delete records from a table. Part of this table is displayed in a form (subform)

DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE Temp.* FROM Temp"
DoCmd.SetWarnings True

After deleting the records, all the cells are filled with the value #Deleted.
Only when i reopen the form then would the #Deleted value be gone.
You could use Me.Requery after your DELETE line.

Hope this helps,
Brad.
Sep 5 '07 #2

P: 25
You could use Me.Requery after your DELETE line.

Hope this helps,
Brad.
Thanx for you help.

But i tried

Me.refresh

after the line of codes and it works fine.
Sep 5 '07 #3

Scott Price
Expert 100+
P: 1,384
Access' help file has this to say about the Refresh method:
Microsoft Access refreshes records automatically, based on the Refresh Interval setting on the Advanced tab of the Options dialog box, available by clicking Options on the Tools menu. ODBC data sources are refreshed based on the ODBC Refresh Interval setting on the Advanced tab of the Options dialog box. You can use the Refresh method to view changes that have been made to the current set of records in a form or datasheet since the record source underlying the form or datasheet was last refreshed.

The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn't actually requery the database, the current set won't include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.
In your situation, I suspect that the Requery method will be far more accurate. Especially if doing your deletions makes some of the records no longer conform to the criteria of your underlying query.

Regards,
Scott
Sep 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.