Adding data records

  • Thread starter Thread starter Tull Clancey
  • Start date Start date
T

Tull Clancey

Hi, hope someone can help with the following, I'm a bit stuck!

I have a database table (Access) with an AutoNumber field. When I add data
to the table I want to use the AutoNumber field, format it and save the
result in another field within the same record.

Using SQL I can "Insert Into..." without a problem but Access doesn't have
any call back features so I don't know what the AutoNumber field contains.

In old ADO I used to open an empty recordset-
Rst.Open"Select * from myTable where 0=1;", DBConnection) and then manually
add the record-
Rst!FormatField=format(Rst!ID,"00000000")
Rst!Update

I assume I'll have to use a DataTable to achieve this, I've played about a
bit, I can 'seemingly' add a record to a table I've loaded, but can't save
the changes back to the database.

Any ideas?

Cheers,
Tull.
 
¤ Hi, hope someone can help with the following, I'm a bit stuck!
¤
¤ I have a database table (Access) with an AutoNumber field. When I add data
¤ to the table I want to use the AutoNumber field, format it and save the
¤ result in another field within the same record.
¤
¤ Using SQL I can "Insert Into..." without a problem but Access doesn't have
¤ any call back features so I don't know what the AutoNumber field contains.
¤
¤ In old ADO I used to open an empty recordset-
¤ Rst.Open"Select * from myTable where 0=1;", DBConnection) and then manually
¤ add the record-
¤ Rst!FormatField=format(Rst!ID,"00000000")
¤ Rst!Update
¤
¤ I assume I'll have to use a DataTable to achieve this, I've played about a
¤ bit, I can 'seemingly' add a record to a table I've loaded, but can't save
¤ the changes back to the database.
¤

See if the following helps:

HOW TO: Retrieve the Identity Value While Inserting Records into Access Database By Using Visual
Basic .NET
http://support.microsoft.com/kb/815629/EN-US/


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Yes I found this, but it's incredibly long winded. Is there no way anymore
to simply access a data record?
 
¤ Yes I found this, but it's incredibly long winded. Is there no way anymore
¤ to simply access a data record?
¤

Not if you're using auto increment data types.


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top