473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Adding data records

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.
Nov 21 '05 #1
3 1331
On Wed, 15 Jun 2005 12:16:04 +0000 (UTC), "Tull Clancey" <tu**********@btopenworld.com> wrote:

¤ 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)
Nov 21 '05 #2
Yes I found this, but it's incredibly long winded. Is there no way anymore
to simply access a data record?
"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:h8********************************@4ax.com...
On Wed, 15 Jun 2005 12:16:04 +0000 (UTC), "Tull Clancey"
<tu**********@btopenworld.com> wrote:

¤ 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)

Nov 21 '05 #3
On Wed, 15 Jun 2005 14:43:08 +0000 (UTC), "Tull Clancey" <tu**********@btopenworld.com> wrote:

¤ 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)
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
3
by: Raj | last post by:
Hi, I am trying to add some more information to the table which already has a lot a data (like 2-3000 records). The new information may be adding 2-3 new columns worth. Now my questions are:...
6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: Paul Smith | last post by:
I have a web form which collects user data. It is populated with options stored in an access DB. I have successfully managed to bind my form controls to the required sources. My problem is now...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
9
by: Kadett | last post by:
Hi all, I have following problem: I'm creating a ListView (Details) control at run-time and filling it with some records (let's say 10 000). This operation seems to be quite fast, but when I call...
12
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the...
0
by: EricLondaits | last post by:
Hi, I have an ASP.NET page with a ListBox that is data bound to a table with a single field (it holds a list of valid IDs). The page also has a textBox into which you can add new valid IDs, one...
2
by: Steve | last post by:
I have zero experience with ODBC. If I have an Access frontend connected to a SQL Database using ODBC, are the tables connected like a frontend/backend Access database where the the tables you see...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.