Drew Wutka
DWUTKA at Marlow.com
Thu Jul 2 14:31:52 CDT 2009
No problem. That 'autonumber trick' is handy. It falls into the territory of using a 'key' as meaningful value, though it really is not. It's just using Jet to give you a sequential number (and the append trick allows you to 'set' the number to start wherever you want). You original solution only has the 'duplicate' issue in a multi-user scenario, which is the one thing that Jet will handle for you in an autonumber field. So either way works, I don't think you'll do any less work to get either to work. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Asger Blond Sent: Thursday, July 02, 2009 2:16 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Custom autonumbering Thanks Drew. Didn't know it was that simple. In T-SQL you would have to use SET IDENTITY INSERT ON before explicitly setting a value for an Identity field. Quite new to me that you can just use an INSERT statement on an AutoNumber field in Access. Now your two-table approach is certainly an alternative to consider for me. Asger -----Oprindelig meddelelse----- Fra: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] På vegne af Drew Wutka Sendt: 2. juli 2009 05:01 Til: Access Developers discussion and problem solving Emne: Re: [AccessD] Custom autonumbering #2 is pretty easy to... INSERT INTO tblOrderNumber ([OrderNumber],[OrderID]) VALUES (20098000,0) Then DELETE * FROM tblOrderNumber WHERE tblOrderNumber=20098000 And whalla, your next OrderNumber will be 20098001 Drew -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.