?
Solved

Error in updating records

Posted on 2001-06-22
9
Medium Priority
?
191 Views
Last Modified: 2010-05-02
 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
Comment
Question by:tayleeming
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6217764
Hi, Are you sure all records are updated?

How about add DoEvents in the loops?
0
 
LVL 18

Expert Comment

by:deighton
ID: 6217790
What are you using ADO, ODBC etc...
0
 
LVL 4

Expert Comment

by:IainHere
ID: 6217904
> 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6218008
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
 
LVL 3

Expert Comment

by:jrspano
ID: 6218401
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
 
LVL 9

Accepted Solution

by:
Valliappan AN earned 100 total points
ID: 6218962
tayleeming,

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

Cheers.
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6408644
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
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6408647
BTB, could I know, why you have graded a C, was it there anything more you needed, for your problem?
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6408789
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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

765 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