Login
`
Templates, Tools and Utilities
|
||
Icetips Article
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, 7:47 am This article has been viewed 35198 times.
|
|