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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection to Access but data won't post?

Status
Not open for further replies.

amateursRus

Technical User
Oct 10, 2005
15
0
0
GB
Hi Folks,

Can anyone help?
I've developed a simple reporting app which uses Access to store temporary data prior to printing using MS Word.
The first time a report is selected and run everything works fine and the data is correctly printed.
However, if the user tries to run a subsequent report the app throws up db errors.
I've been able to determine that the connection to Access is successfully established - it just seems that no data is being accepted by the db tables.
Now, this happens even if the user tries to run the same report as has been successfully run previously....
The connection is open, the tables are available and nothing's happening.

Anyone got any (and I mean ANY) ideas?

Regards

Steve
 
hi

How are you building the report? If you're using Queries, you may need to reset the cursor position in the dataset with MyQuery.First; Can you supply some sample code?
 
Hi LucieLastic,

Thanks for the quick response!
Sorry if I wasn't too clear at first but the problem isn't in reading data from Access but in writing data.
Here's some of the code I'm using to write to the AdoQuery:

with DataModule1.ADOQuery1 do begin
Open;
InsertRecord([RecArray[cntr].Processno,
RecArray[cntr].ProcName,
RecArray[cntr].UserID,
RecArray[cntr].isAdmin,
tRjctCount]);
end;
This is followed in later code by an update batch call:

ADOQuery1.UpdateBatch(arAll);

This all works fine on first run but (although no errors are reported here) on subsequent runs nothing is actually being written to Access.

The error reports occurr in later code which retrieves data from Access for analysis prior to printing to Word.

It reports "cannot convert Null to string" - this is because nothing has been written to the relevant (temporary data) Db table, so obviously, there's no data to write to the permanent table.

I've been carefull to clear down all variables, stringlists, arrays and Db connections between successive runs of the report to avoid leaks and conflicts, etc.

It's almost as if the second reports data just drops off the edge of the world somewhere between Delphi and Access...

I've spent two days now following the code through line by line, adding checks at various points and I'm convinced it's something to do with the Access connection properties.
But then, maybe I'm not seeing the wood for the trees...?

Regards

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top