0

I am writing a program that uses two modules, a VCL win32 application module and a Datamodule to contain ADO components and a clientdataset to work the data in memory.

When compiling the code fails with the message Raised Exception class EAccessViolation in Module EstimateMngr.exe. The debugger shows failrue in the following code:

procedure TForm3.ResetDataSets;
begin
  //Fails in next line at the IF statement
  IF DataModule3.TaskClientDataSet.Active THEN DataModule3.TaskClientDataSet.Close;
    DataModule3.ADOTaskTable.ConnectionString := AccessCxHelper.CXString;
    DataModule3.TaskClientDataSet.Open;
End;

The DataModule unit is in the uses clause. Tracing the execution shows that once it finishes reading the first line, it jumps to a function VirtualQuery in the Windows unit, then to GetModuleFileName in Windows, and then into the process to raise the exception.

Does anyone have suggestions?

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by cVz
0

I have an idea... i should work...If you are using Delphi - go to 'Project' - 'Options' - then a menu will appear that shows you your forms, put ALL your forms before your Data module page, they will then run before the data module and your problem is solved, also try this - set all connections to false, then code on your form show event

DBMODULENAME.TABLENAME.Open;

and on form close

DBMODULENAME.TABLENAME.close;

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.