User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS Access and FileMaker Pro section within the Web Development category of DaniWeb, a massive community of 426,877 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,290 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS Access and FileMaker Pro advertiser: Programming Forums
Views: 8003 | Replies: 1
Join Date: Mar 2005
Posts: 14
Reputation: hippychic43 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
hippychic43 hippychic43 is offline Offline
Newbie Poster

Access INSERT problem

  #1  
Jul 28th, 2005
Heya,

I have a table that has a primary key that is generated automatically by the database, so when I write an SQL statement in my program to insert information into the table, I insert values for every field but the primary key field.

The problem here is that in my program I do not know the value of the primary key field. I was wondering if there was any way I could get an INSERT statement to return the value of the primary key field for the record it has just inserted?

The only way I've found of doing this for the moment is by opening the database connection again, once the INSERT statement has been performed, and doing a SELECT query that selects the primary key from any records that match all of the other information I created the record with. Of course if there is two records with exactly the same information for all of the other fields then I'm screwed. In my application that shouldn't happen, but I don't like that the possibility is there.


Thanks
Cristy
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS Access and FileMaker Pro Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS Access and FileMaker Pro Forum

All times are GMT -4. The time now is 10:23 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC