Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / October 2003



Tip: Looking for answers? Try searching our database.

returning key value for inserted record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Woody - 30 Oct 2003 16:43 GMT
vb6, sp5. access 2000, sp3.

I have a table with teh key defined as autonumber.

i use a sql insert statement to insert the record into the record set.
how do i get the keyvalue of the record that i just inserted?

i sincerely appreciate your time and consideration.

Woody
any sugestion or comment made by me should be examined first for
validity and appropriateness before assuming i  have any idea at all
what the heck i am talking about.  I am not responsible for anything you
may see with my name attached to it, i think.
Al Reid - 30 Oct 2003 17:14 GMT
Try adding:

rst.Open "SELECT @@IDENTITY"
lngID = rst(0).Value

immediately after your Insert statement.
--
Al Reid

"It ain't what you don't know that gets you into trouble. It's what you know
for sure that just ain't so."  --- Mark Twain

> vb6, sp5. access 2000, sp3.
>
[quoted text clipped - 13 lines]
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Woody - 31 Oct 2003 13:58 GMT
thanx, works like the proverbial champ!

Woody
any sugestion or comment made by me should be examined first for
validity and appropriateness before assuming i  have any idea at all
what the heck i am talking about.  I am not responsible for anything you
may see with my name attached to it, i think.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.