开发者

Need to (force) the refresh of the MS Access database immediately after the delete statement

I use an MS Access database. In the code below, I loop through a recordset and delete each record. Directly after the delete statement, the function RefreshPlanning perform a select query based on the same table. The problem is that the record is not instantly deleted in the table and so the RefreshPlanning is querying some record who normally has been deleted! So I need to refresh the db (empty the cache?) instantly after the delete statement. How can I proceed?

    Dim rstTraitements as ADODB.Recordset
    Set rstTraitements = SelectQuery("SELECT * FROM tblTraitements WHERE ID like 123")

    ' Loop through all selected elements.
    While Not rstTraitements.EOF
       ' Delete current record in the table.
       rstTraitements.Delete
       MsgBox "a database refresh is needed here before the next statement"
       RefreshPlanning DatePlanning, CodeEquipement           
       rstTraitements.MoveNext
    Wend

Remark 1: SelectQuery is a function who return a recordset

Remark 2: RefreshPlanni开发者_StackOverflow社区ng is a function who perform a select query based on the same table (tblTraitements).

Thank you for your help.


Try

rstTraitements.Resync

or

rstTraitements.Requery

after the delete

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜