Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Error in updating records

 Below is my problem nature:

  I have a database table located at network(Microsoft Access format)which i need to update it frequently, before i do the updating process i must extrac the same group of data to get certain info from it and then update the selected records accordingly.

  My problem now is that when i perform the updating process too frequently(using loop), i found out that the previous updating process is not complete yet,and i can't select the correct amount of records to do the next update process... Is that anyway that can let me do the detection to prevent this kind of problem?  

My Problem's Detail:
 
- I'm using ADO and DSN in communicate and connecting my access database located in network. In the same time i m using a datagrid control that let the user input their data and see the change.
   
- I'm sure that my code logic can work finelly because when i debug the code step by step using F8, all my records are update correcttly.Actually just few particular field can't be update correcttly during my program normal execution.


Extra :

-When i using the DataGrid Control in acceptting and showing the output, i hit a problem that the data will automatic store into the correspone table, which i don't want it to happend, i only want the data to be saved when the user click on the Save button. This problem continue to occur even i already uncheck the AllowUpdate property in the DataGrid control, can anyone provide me a solution for this?  
0
tayleeming
Asked:
tayleeming
1 Solution
 
Ryan ChongCommented:
Hi, Are you sure all records are updated?

How about add DoEvents in the loops?
0
 
deightonCommented:
What are you using ADO, ODBC etc...
0
 
IainHereCommented:
> i found out that the previous updating process is not complete yet

Could there be a logic error in your code?  After you perform an Update, the next Refresh call will see the data you changed.  Is your query asynchronous?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Valliappan ANSenior Tech ConsultantCommented:
You would wish to flush the changes to hard disk, when Committing changes in transaction, immediately after the update, which could cause some slow, in doing things. But, it could do what you want, that is, immediate update, if I am right.

Cheers.

0
 
jrspanoCommented:
you have to flush the cache in access

ex
datLabelHistory is a dao data control that is pointed to the access database and setup to use a table
in the db

datLabelHistory.Recordset.Edit
datLabelHistory.Recordset!PrintDate = now
datLabelHistory.Recordset.Update

  'flush the lazy write cache to update the recordset to print It
DBEngine.BeginTrans
DBEngine.CommitTrans dbForceOSFlush

you do more updates here
DBEngine.BeginTrans
DBEngine.CommitTrans dbForceOSFlush
more updates here etc
DBEngine.BeginTrans
DBEngine.CommitTrans dbForceOSFlush

you can also wrap your edits
ex
DBEngine.BeginTrans
update1 here
DBEngine.CommitTrans dbForceOSFlush
DBEngine.BeginTrans
update 2 here etc
DBEngine.CommitTrans dbForceOSFlush
0
 
Valliappan ANSenior Tech ConsultantCommented:
tayleeming,

If you use DAO, then jrspano's code, could work. Otherwise, tell what you are using.. ADO or RDO?

Cheers.
0
 
Valliappan ANSenior Tech ConsultantCommented:
tayleeming,

i just suggested. Did you choose mine by mistake, for choosing jrspano's, since the Accept Comment As Answer, could look like that?

I dont mind transferring the points, in any case.
0
 
Valliappan ANSenior Tech ConsultantCommented:
BTB, could I know, why you have graded a C, was it there anything more you needed, for your problem?
0
 
Ryan ChongCommented:
Hi tayleeming,

Always NOT given an expert a grade "C" (or B) because experts are spending their time try to solve your problem!

Given C is NOT what we wanted. Try to give an expert A if his comment make help to you.

regards.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now