` Manually controlling autoinc fields (Shawn Simmons ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

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 April 19, 2024, 6:34 am
This article has been viewed 35110 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: