Solved

Error in updating records

Posted on 2001-06-22
9
186 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 51

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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

 
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 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 51

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 …
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…
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…

829 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