Board index » delphi » Paradox autoIncrement

Paradox autoIncrement

I am trying to pass a value from an autoincrement field of a paradox table
to another field in a second table.  How can I do this.

I tried assigning the value of the field to a variable

example-----------
var
I : Integer

begin
  I := dmMain.tbMaster['Reference Number'].AsInteger;
  dmMain.tbUpdate.Append;
  dmMain.tbUpdate['Reference Number'] := I

end example---------

Additional info------------

  tbMaster[Reference Number] = autoincrement field
  tbUpdate[Reference Number] = Long Integer

End additional info--------

When I do this and run the program, I get an error that states "VARIANT DOES
NOT REFERENCE AN AUTOMATION OBJECT"

How can accomplish this task?

Any help will be appreciated.

cg

 

Re:Paradox autoIncrement


Quote
On Mon, 4 Dec 2000 16:35:29 -1000, "cg" <guav...@hotmail.com> wrote:
>I am trying to pass a value from an autoincrement field of a paradox table
>to another field in a second table.  How can I do this.

>I tried assigning the value of the field to a variable

>example-----------
>var
>I : Integer

>begin
>  I := dmMain.tbMaster['Reference Number'].AsInteger;
>  dmMain.tbUpdate.Append;
>  dmMain.tbUpdate['Reference Number'] := I

try: dmMain.tbUpdate['Reference Number'].AsInteger := I

Quote

HTH,
Dan

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com
[SPAM block: change at to @ in my e-mail address]

Re:Paradox autoIncrement


If you really want to make this right, in your datamodule's (hope you
have one) CLASSes public property, put one integer variable.
Call it, for example, 'ix'
so :
.
.
.
public
  ix:integer;
end;

On the creation of datamodule open your main table with autoinc field
and read value of it in the last record.

Then make for all tables procedures on beforeInsert,
beforePost,afterPost and beforeDelete and in them make sure all tables
gets proper value of "ix", or that records are deleted properly.

Make that "ix" always contain true value of last autoinc... Then you
can access that value from other units that uses datamodule.

Quote
On Mon, 4 Dec 2000 16:35:29 -1000, "cg" <guav...@hotmail.com> wrote:
>I am trying to pass a value from an autoincrement field of a paradox table
>to another field in a second table.  How can I do this.

>I tried assigning the value of the field to a variable

>example-----------
>var
>I : Integer

>begin
>  I := dmMain.tbMaster['Reference Number'].AsInteger;
>  dmMain.tbUpdate.Append;
>  dmMain.tbUpdate['Reference Number'] := I

>end example---------

>Additional info------------

>  tbMaster[Reference Number] = autoincrement field
>  tbUpdate[Reference Number] = Long Integer

>End additional info--------

>When I do this and run the program, I get an error that states "VARIANT DOES
>NOT REFERENCE AN AUTOMATION OBJECT"

>How can accomplish this task?

>Any help will be appreciated.

>cg

Other Threads