One thing I like to do is put in the current date/time into the db as well, then do a query based on that same date/time to get my PK. Brian Yager President - North AL Cold Fusion Users Group Sr. Systems Analyst NCCIM/CIC (256) 842-8342 -----Original Message----- From: Shannon Rhodes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 8:41 AM To: CF-Talk Subject: Question: Creating a primary key field Is it possible to query which was the last ID number created (autonumber field in Access) for the purpose of adding 1 to explicitly state the new ID number for a newly created record? The reason why I ask is that I'm having trouble inserting my new info into two separate tables because I need the newly created ID number for table A to be inserted into table B. If I can't "guess" what the number will be, I'm stuck trying to take the user through a second page where I insert into table A then turn around and query the new record to insert the new field into table B. That leaves me with the problem of what to do if the user abandons the application on the second page, leaving no new record created in table B. This may sound like screwy application design (and maybe it is, I'm still pretty new at this), but the problem is that table A contains contact information, while table B contains all other information (class registration, payment methods, etc), and they have a one-to-one relationship because I may need to change which person the info is associated with (it's possible that a person will register and pay for a class, but a co-worker will attend in their place). I can't make the classID a primary key in table B either (the person could decide to switch classes) so I just have an autonumber as a primary key. Argh! All suggestions welcomed. TIA, Shannon [EMAIL PROTECTED] FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Question: Creating a primary key field
Yager, Brian T Contractor/NCCIM Wed, 01 Aug 2001 06:34:03 -0700
- Question: Creating a primary key field Shannon Rhodes
- RE: Question: Creating a primary key ... Yager, Brian T Contractor/NCCIM
- RE: Question: Creating a primary key ... Stuart Miller
- RE: Question: Creating a primary key ... Mark Smyth
- RE: Question: Creating a primary key ... Yager, Brian T Contractor/NCCIM
- RE: Question: Creating a primary key ... Dave Watts
- RE: Question: Creating a primary key ... Stuart Miller
- Re: Question: Creating a primary ... Joseph Thompson
- RE: Question: Creating a primary key ... Yager, Brian T Contractor/NCCIM
- RE: Question: Creating a primary key ... Susan Allen
- RE: Question: Creating a primary key ... Stuart Miller

