473,396 Members | 2,076 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,396 software developers and data experts.

how to get row just inserted

ASP 3 and Access 2000. I have a page which enters a row into a table, and
then enters some other info into another table. Problem is, I need to do the
first one, then obtain the PK, which is an Autonumber, so I can enter it
into the other table.

I know how to do this in SQL Server with identity columns, but this is
Access. (I know Access is not very good, but I have to use it for this
church project.)

Here's my code:

strFName = Replace(Trim(Request.Form("FName")),"'","''")
etc.

strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[etc]"
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString = strConnection
objConnection.Open
strSQL = "INSERT INTO Personal(etc) "
strSQL = strSQL & "VALUES(etc) "
objConnection.Execute strSQL

So now I need to do a SELECT from the Personal table, then enter that into
the table which consists of 2 fields, both of which are FK's for other
tables (this table was put in to resolve a many-to-many relationship)

FWIW, I'm doing this in a loop; that is, I have a variable number of
checkboxes, and for each one checked by the user, I'll have to insert a row
into this 2nd table. One one entry into the first table, though.

Any help would be appreciated.


Jul 19 '05 #1
2 1939

"middletree" <mi********@htomail.com> wrote in message
news:u5**************@TK2MSFTNGP12.phx.gbl...
ASP 3 and Access 2000. I have a page which enters a row into a table, and
then enters some other info into another table. Problem is, I need to do the first one, then obtain the PK, which is an Autonumber, so I can enter it
into the other table.


http://www.aspfaq.com/show.asp?id=2174

Ray at home
Jul 19 '05 #2
Dang! I usually go to aspfaq first, but didn't do it this time. Thanks!
"Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
news:eu**************@TK2MSFTNGP09.phx.gbl...

"middletree" <mi********@htomail.com> wrote in message
news:u5**************@TK2MSFTNGP12.phx.gbl...
ASP 3 and Access 2000. I have a page which enters a row into a table, and then enters some other info into another table. Problem is, I need to do

the
first one, then obtain the PK, which is an Autonumber, so I can enter it
into the other table.


http://www.aspfaq.com/show.asp?id=2174

Ray at home

Jul 19 '05 #3

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

Similar topics

3
by: hshen | last post by:
Hi All, I have encountered a weird behavoir of embedded MySQL. Through a simple program I made (in Delphi 6), I can insert rows to a table through embedded MySQL and I can retrieve the rows from...
2
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. ...
2
by: Juan | last post by:
Do i have to loop trough a datagrid in order to find and select a row just being inserted in the dataset connected to the data grid? is there any event i can capture in the datagrid to obtain the...
1
by: Bennett Haselton | last post by:
Suppose I add a new row to a table in a dataset, and then I use an OleDbDataAdapter to add that new row to a SQL Server database using OleDbDataAdapter.Update(), as in the following code: ...
66
by: mensanator | last post by:
Probably just me. I've only been using Access and SQL Server for 12 years, so I'm sure my opinions don't count for anything. I was, nevertheless, looking forward to Sqlite3. And now that gmpy...
0
by: baaul | last post by:
I need to INSERT rows from #temp table into #final table with grp_code and bap_id combination. Thanks. Create Table #tmp ( sort_id int default 0, grp_Code int default 1,...
0
by: chirnag | last post by:
I have and audit table to collection changes happening on an entity. This will be taken care by triggers. During a batch test, I found that out of 1000 inserts into the main table, I got only 997...
3
by: JurgenvonOerthel | last post by:
I want to replace one element in a list<stringby a list<stringand I need to obtain an iterator to the first element in the inserted list. In code: void...
4
by: rcamarda | last post by:
I have a UDF that cleans a field of control characters and I use it like this select dbo.udf_CleanAlphaNum(Address1) as Address1 from Leads It works great. I use it to clean several fields...
2
by: HotFrost | last post by:
Hello everyone, i am trying to work with linked servers... The local server is the one used by UPS worldwide software (it is Microsoft SQL Server Desktop Engine, v 8.00.2050). The linked server...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.