Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read and write record

Status
Not open for further replies.

VBmim

Programmer
Jun 25, 2001
361
BE
I have a problem I have been struggling with for a while... I have to write a whole lot of records, and directly thereafter I have to show them in a datareport. All the records but the last one are on the report. When I check my database, the record has been written.
This is very anoying. I have solved it partly by putting a message box between the writing and the showing, but I think this is not very professional.
Does anyone have any tips I could use?

Tnx in advance

Mim
 
It could depend on what you are using to loop through the records you are printing. Some checks do not enter your code to print .. others may enter at least once.
If you are using the .MoveNext at the end of a loop and it checks for .EOF this may be the cause of the last record not being written. Just a thought.


Joanne
 
Sounds to me like your loop may be faster than the update to the database, since the record NOT included in the report IS in fact being updated to the database. I had a similar issue where the user adds a new record, then my program refreshes the rs and searches for the new record. Every time, the Ado doesn't find the new record on the first try, so I'm actually calling that function twice, and it finds it on the second try every time..??

You may try to add the Sleep(dwMilliseconds) API between the update loop and the report loop (if that's how u have it set up), since a message box seems to solve ur problem. You can quickly check to see if this will work by building the report twice, and only checking the second one. If your record is there, sleep for 500 milliseconds and build it once.

Hope that helps!

-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top