Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Par2: Manually controlling autoinc fields 1998-12-23 -- Shawn Simmons 1) Create A Local Variable in your form called RECORDADDEDFLAG and set it to
a byte.
2) In the Windows init priority 1 method:
If GlobalRequest = InsertRecord
Set(Ven:PrimaryKey)
Previous(Vendors)
If Error() Then RecordID# = 1 Else RecordID# = VEN:RecordID+1.
Get(Vendors,0);Clear(Ven:Record)
Ven:RecordID = RecordID#
!Prime any other fields here
Access:Vendors.Insert()
Relate:Vendors.Fetch(Ven:PrimaryKey)
GlobalRequest = ChangeRecord
RecordAddedFlag = True
End
3) At Windows Kill Method priority 4000:
If Self.Response = RequestCancelled AND RecordAddedFlag Then
Relate:Vendors.Delete(0).
4) I know this is a brute force way of defining the AUTOINC, but it has
NEVER failed me. Make sure that you remove the AUTOINC attribute from the
primary key in your access table.
Today is November 21, 2024, 6:52 am This article has been viewed 35197 times.
|
|