Solved

Need Access DAO db.openrecordset to show changes

Posted on 2008-10-31
3
316 Views
Last Modified: 2013-11-27
Hello,

I need to open a DAO recordset in Access that will reflect changes made to the data while the data is being referenced.  I currently do not change the data using the recordset, but I do run other processes based on what I find in the record.  I need to see those changes as I continue to review the record as additional processes might need to be run based on what was updated.  The data come from only one Access table that resides within the same database as the code for the processing.

I have experimented with all of the openrecordset property calls that I thought made sense, but have not come up with the magical combination.

I could rewrite the code, but I am trying to avoid that.
0
Comment
Question by:WEhalt
  • 2
3 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 22856121
dbengine.Idle dbrefreshcache

See Idle in Help.
0
 

Author Comment

by:WEhalt
ID: 22861990
I added the line above, but it is still not refreshing.  I did notice in the help that it is not supposed to be necessary in single-user environments, but I don't think that explains why it is not working.  

Should I try a DoEvents or am I missing something larger?

This is how I am testing.  I am not attaching the full code because I think it is toolong and involved to make much sense, but I can if you would like.

...Open recordset
    Set tbl = db.OpenRecordset("SELECT * FROM TABLE", dbOpenDynaset)
    With tbl
    Do Until .EOF ... start loop

Perform tests that are resident within the fx intself
Based on a series of nested if/then/else, it calls a separate fx that
    updates the table and in doing so field tDt2Ck
    both what field tDt2Ck is and what fx is called varies
**Note I am not using this recordset to perform the update
    Instead, I am calling another function that performs more tests
        and then updates various date in the table accordingly

Then I try to see the changes
        MsgBox tAgy & "'s " & tDt2Ck & " Before - " & .Fields(tDt2Ck)
        DBEngine.Idle dbRefreshCache
        MsgBox tAgy & "'s " & tDt2Ck & " After - " & .Fields(tDt2Ck)

I can see that the correct updates are being made, but I am not able to see them while the fx is running so actions that are supposed to be performed later, based on the value in tDt2Ck, are not occurring.

Thank you for your help.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 22883683
Well it clearly won't do any harm to try doevents but I think I'd be surprised if it worked if the Idle command does not - give it a go and see.
I don't really have much else to suggest short of continually requerying the recordset which would mean you have to deal with maintaining the correct position in the rs. Maybe in that scenario, you would be better of just reading single records into the rs based on the id value.  Sorry I can't be more help.

0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question