This is a discussion on "Insert Record" within the Classic ASP section. This forum, and the thread "Insert Record are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Insert Record
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Insert Record
i have a insert Record page, and an access database with an autonumber field (ProductID), is it possible to show the autoincremented ProductID in the insert record form? So that user knows wht's the ProductID for the record he is going to add?
Please help. Thanksss. |
|
|
|
#2
|
|||
|
|||
|
If there's only one user for the system you could, but otherwise it's not possible. For example 3 different people could add a record between you starting to fill out your form and finishing it, and that would change the next ID used.
That said, there is a way around it. You could add a blank entry to the database when the user starts the form, then report back the ID that was created, then use the ID to update the record when the user is done. You'd need to deal with people cancelling their add though, and the blank record that would be left from it - which is possible, just not simple. |
|
#3
|
|||
|
|||
|
I've always used @@Identity (SQL) for this in the past, but I've never been able to do this in Access, despite the fact that the MS documentation says it's possible...
|
|
#4
|
|||
|
|||
|
The Jet OLEDB Provider supports @@Identity, check it out:
http://adopenstatic.com/experiments/...autonumber.asp |
|
#5
|
|||
|
|||
|
Yeah, but red wants the identity prior to adding the record...
|
|
#6
|
||||
|
||||
|
This will involve creating a blank record.... then grabbing the id number. When the record is finally inserted, it will UPDATE the blank record.
Any other method will involve locking, and keeping the lock on until the record is finally added..... as this is dependant on user input, the lock could be on a fair while. I really dont see though, why the user would need to see the record number? If they do, then cant you just reveal it to them after they have added the record?
__________________
Click the 'Thanks!' button if this post has helped you Rob - Webforumz Founder
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
#7
|
|||
|
|||
|
what about selecting the last record id and adding 1 to it?
|
|
#8
|
|||
|
|||
|
That would only work on a 1 user system smokie.
|
|
#9
|
|||
|
|||
|
As yes, I should have read your first reply!
|
|
#10
|
|||
|
|||
|
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />Originally posted by redkyna
i have a insert Record page, and an access database with an autonumber field (ProductID), is it possible to show the autoincremented ProductID in the insert record form? So that user knows wht's the ProductID for the record he is going to add? Please help. Thanksss. <hr height="1" noshade="noshade" id="quote" /></blockquote id="quote"> |
|
#11
|
|||
|
|||
|
thanks guys, i have put it this way, not using the autonumber anymore but set it to no-duplicates. Get the max(id) then plus one. The system will only be used for 2 or 3 ppl so i guess this will work just fine.
|
|
#12
|
|||
|
|||
|
The no-duplicates will just give you an error when you try to add using your guessed new id if someone else uses that id first, so I don't know that it'll be a good solution for this.
|
![]() |
| Tags |
| insert, record |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SQL Insert help | air duster | Classic ASP | 13 | Jan 12th, 2006 08:38 |
| Insert record in mysql | djme | Databases | 1 | Dec 24th, 2005 01:42 |
| insert record | accessman | Databases | 1 | Oct 15th, 2005 01:12 |
| how to quickly insert a record | gab | Classic ASP | 5 | Oct 31st, 2003 18:28 |