WEhalt
asked on
Need Access DAO db.openrecordset to show changes
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.
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.
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
See Idle in Help.