From: Rob Christiansen on
I'm apparently using the wrong function. I create a new record in my
*.mdb file and append it on the end of the file -
..
SQL = "INSERT INTO books1 ";
SQL += "( fprevrec, fnextrec, fforegrnd, fbackgrnd, fyear, fmonth,
fbank, finitials, ftype, fcheck, fdate, fdescription, fdebit, fcredit,
";
SQL += "fproject, fmsc1, fmsc2, fmsc3, fmsc4, fmsc5, fmsc6, fmsc7 )
VALUES ( ";
SQL += ""+ prevrecnum +", ";
SQL += ""+ nextrecnum +", ";
SQL += " 'fcolor', ";
SQL += " 'bcolor', ";
SQL += "'"+ newyear +"', ";
SQL += "'"+ newmonth +"', ";
SQL += "'"+ newbank +"', ";
SQL += "'"+ newinitials +"', ";
SQL += "'"+ newmsc7 +"' )";
ConnectionObject.Execute( SQL );
..
- ok, mostly this works fine. On ocassion, however, for reasons I can't
understand, it plops the new record right in the middle of the file (any
old random location) Very frustrating!!! I wasn't aware it could even do
this. It must be rewriting the file every time! This is not what i want.
It screws up the whole operation when it does this. I want it to simply
append the new record, every time and all times.
..
Do i have to open the file for append?


crazyswede

*** Sent via Developersdex http://www.developersdex.com ***
From: Evertjan. on
Rob Christiansen wrote on 11 mei 2010 in comp.lang.javascript:

> I'm apparently using the wrong function. I create a new record in my
> *.mdb file and append it on the end of the file -
> .
> SQL = "INSERT INTO books1 ";
[...]

> .
> - ok, mostly this works fine. On ocassion, however, for reasons I can't
> understand, it plops the new record right in the middle of the file (any
> old random location) Very frustrating!!! I wasn't aware it could even do
> this. It must be rewriting the file every time! This is not what i want.
> It screws up the whole operation when it does this. I want it to simply
> append the new record, every time and all times.
> .
> Do i have to open the file for append?

In a 4th generation database there should be no begin or end of file in
absolute sense, and the order of retrieving should be defined by the SQL
"ORDER BY .." directive.

"open for append" is only logically defined in text files,
not in databases.

However, possibly, you have not defined an autoincrement field with a
primary key in your .mdb creation?

It seems to me that a file with an autoincrement field with primary key
will also reuse deleted records, but you won't be able to recognize them.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)