Solved

Error in updating records

Posted on 2001-06-22
9
182 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
9 Comments
 
LVL 49

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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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 50 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 49

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now