` Printed Icetips Article

Icetips Article



ABC: Priming records on insert
1999-01-05 -- Jim Katz
 
Newsgroups: topspeed.products.c4

> I want to do the same as in a generated window. I want a button called
> Create, which calls a create window (or rather a UpdateXXXX in create
> mode.). The special thing is that it is not the table being browsed I want
> to create a record in.

Assuming you have created a form procedure for the record you wish to update,
you must set the GlobalRequest to InsertRecord immediately  before the form is
called. And you must prime the record by doing Access:FileName.PrimeRecord(),
this method returns 0, or level:benign if successful. So you can do something
like this:

If Not Access:MyFile.PrimeRecord()  !! Prime the record
  GlobalRequest = InsertRecord
  Update:Myfile  !! < call the update proc
  If GlobalResponse = RequestCancelled
    Access:MyFile.CancelAutoInc()  !! Call this if you have an auto-increment key
  End
  Clear(GlobalResponse)
End

HTH

--
Jim Katz



Printed November 21, 2024, 7:32 am
This article has been viewed/printed 35383 times.
Google search has resulted in 12 hits on this article since January 25, 2004.