Inserting a new record without a browse,using form only

I am developing an invoice application (yes, I know there are thousands of them already :).

I have a button named ‘btnNewOrder’ which calls the orderform directly, ‘frmOrdre’.
It is not an mdi child form. I have the requested file action to be ‘insert’.

The button shows the form, but it defaults to first record with data. I need to have a blank order form in insert record mode.

I tried to insert the foll. code in the buttons accepted embed point:

clear(Faho:Record)
GlobalRequest=InsertRecord
Faho:Id=0

But the result is the same - defaulting to first record.

Any suggestions?

Brgds
Werner

Programming in Clarion ABC - PDF Version - Available from ClarionShop.com

Will show you exactly how to do this, plus tons more helpful tips and tricks etc.

HTH
Carl

Did you put this code in the BEFORE Generated Code embed point.

Show the Code from the generated CLW or Embeditor. It should look like this with your code before calling the Form procedures:

OF ?btnNewOrder
   CASE EVENT()
   OF EVENT:Accepted

      clear(Faho:Record)
      GlobalRequest=InsertRecord
      Faho:Id=0

      FrmOrder()

Are you using ABC templates or Legacy Clarion?

Instead of clear(Faho:Record) you can do clear(FileLabel) which clears the Record, Memos and Blobs.

Carl,

I am using abc.

What I did wrong was to try open the form as a procedure when I clicked the button.

When I did not try to do anything with the button, but just use the embedpoint for ‘accepted’ and insert the code there, it worked.

Thanks for your input.

Werner