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

deleting a record from view cp0014

Status
Not open for further replies.

CyberBoog

Programmer
Oct 14, 2005
5
CA
Hi, i'm working with delphi 5 and the accpac sdk.

And i'm trying to delete a record from the vi "cp0014" and it kept telling me "Delete aborted. The EMPL view must be explicitly composed with the EMPD, EMPT, EMPC and EMBK views"

I've try to add those views with the compose method. But always get the same error. what am i doing wrong ?

 
Doh !

Sorry i forgot to include the code.
This is the delphi source translate from the macro i've recorded in accpac:

procedure TForm1.btnTestClick(Sender: TObject);
var
View0014 : IxapiView;
View0008 : IxapiView;
View0010 : IxapiView;
View0053 : IxapiView;
View0201 : IxapiView;
View0062 : IxapiView;
View0122 : IxapiView;
View0125 : IxapiView;
View0126 : IxapiView;

i : integer;
wdescription : widestring;
description : string;
begin

Session.Open('ADMIN', 'ADMIN', 'SAMLTD', Date, 0);

View0014 := Session.OpenView('CP0014', 'CP');

view0008 := Session.OpenView('CP0008', 'CP');
view0010 := Session.OpenView('CP0010', 'CP');
view0053 := Session.OpenView('CP0053', 'CP');
view0201 := Session.OpenView('CP0201', 'CP');
view0062 := Session.OpenView('CP0062', 'CP');

view0122 := Session.OpenView('CP0122', 'CP');
view0125 := Session.OpenView('CP0125', 'CP');
view0126 := Session.OpenView('CP0126', 'CP');

View0014.Compose(view0008);
View0014.Compose(view0010);
View0014.Compose(view0053);
View0014.Compose(view0201);
View0014.Compose(view0122);

view0008.Compose(View0014);
view0008.Compose(view0125);

view0010.Compose(View0014);
view0010.Compose(view0062);
view0010.Compose(view0126);

view0053.Compose(View0014);

view0201.Compose(View0014);

view0062.Compose(view0010);

view0122.Compose(View0014);

view0125.Compose(view0008);

view0126.Compose(view0010);

View0014.Browse('EMPLOYEE="999999"', 1);

View0014.Fetch;

try
View0014.Delete;
except
if session.errors.Count=0 then
Application.MessageBox('ACCPAC Error', 'Some unknown error occured', IDOK)
else
begin
for i := 0 to session.errors.count -1 do
begin
wdescription := session.errors.error.Description;
description := WideCharLenToString(PWideChar(wdescription), length(wdescription));
Application.MessageBox(PChar(description), 'ACCPAC Error', IDOK);
end;
session.errors.Clear;
end;

end;

end;
 
I don't use Delphi, but in other languages, you compose with arrays, something like this:

View0014.Compose Array(view0008, view0010, view0053, view0201, view0122);

That's why your compositions aren't correct and you're getting the error message.

Jay Converse
IT Director
Systemlink, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top