BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Strange error after importing Word 2003 tlb in d6

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
vd
Guest





PostPosted: Tue Jan 11, 2005 8:18 pm    Post subject: Strange error after importing Word 2003 tlb in d6 Reply with quote




Hi all

Please redirect me if it's not the correct ng.

I've a strange error after importing the word 2003 tlb in D6.
My program worked fine with Word XP and I only did one thing import word
2003 tlb. I've got an error : "instruction wanted but TGUID element found" on a procedure that I have NOT CHANGED.

Here is the procedure :

THis code was given to me by TeamB member a few years ago ( I HAVE NOT Changed this)

function dgGetUniqueNumber(LastNumberTbl: TAdoTable): LongInt;
{Gets the next value from a one field one record
table which stores the last used value in its first
field. The parameter LastNumberTbl is the table
that contains the last used number.}
const
ntMaxTries = 100;
var
I,
WaitCount,
Tries: Integer;
RecordLocked: Boolean;
ErrorMsg: String;
begin
Result := 0;
Tries := 0;
with LastNumberTbl do
begin
Active := Not Active;
{Make sure the table contains a record. If not, add
one and set the first field to zero.}
if RecordCount = 0 then
begin
Insert;
Fields[0].AsInteger := 0;
Post;
end; //if
{Try to put the table that holds the last used
number into edit mode. If calling Edit raises
an exception wait a random period and try again.}
Randomize;
while Tries < ntMaxTries do
try
Inc(Tries);
Edit;
Break; /******* HERE IS THE ERROR *************////
except
on E: EDBEngineError do
{The call to Edit failed because the record
could not be locked.}
begin
{See if the lock failed because the record is locked by
another user.}
RecordLocked := False;
for I := 0 to Pred(E.ErrorCount) do
if E.Errors[I].ErrorCode = 10241 then RecordLocked := True;
if RecordLocked then
begin
{Wait for a random period and try again.}
WaitCount := Random(20);
for I := 1 to WaitCount do
Application.ProcessMessages;
Continue;
end else
begin
{The record lock failed for some reason other than another
user has the record locked. Display the BDE error stack
and exit.}
ErrorMsg := '';
for I := 0 to Pred(E.ErrorCount) do
ErrorMsg := ErrorMsg + E.Errors[I].Message +
' (' + IntToStr(E.Errors[I].ErrorCode) + '). ';
MessageDlg(ErrorMsg, mtError, [mbOK], 0);
Exit;
end; //if
end;
end; {try}
if State = dsEdit then
begin
Result := Fields[0].AsInteger + 1;
Fields[0].AsInteger := Result;
Post;
end
else
{If the record could not be locked after the
specified number of tries raise an exception.}
raise Exception.Create('Cannot get next unique number. (dgGetUniqueNumber)');
Active := Not Active;
end;
end;

Can someone tell me why ? I think it's due to the imported tlb, but I can't see where.

I didn't change the word_tlb code imported by D6.

Thanks in advance

Vincent


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.