• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8743
  • Last Modified:

Oracle Forms Insert Button

I am trying to add an insert record button in to a detail block on a form of which also has a master block linked to the detail block.  I have got a button on the detail block, with a when_button_press trigger with the code insert_record, but this does not work.  Although, if i press the record/insert drop down option it will insert a record into the detail block.  So how can i create the same action but via a form button?
0
creativepresence
Asked:
creativepresence
  • 4
  • 3
1 Solution
 
andrewstCommented:
You need to use the CREATE_RECORD built-in rather than INSERT_RECORD, then the button will work.
0
 
creativepresenceAuthor Commented:
Hi, How could i associated the block WHEN_CREATE_RECORD trigger with the button on the form so that when the user presses the button it goes into insert mode? because the button does not offer the WHEN-CREATE_RECORD trigger.
0
 
andrewstCommented:
You don't need to.  When the CREATE_RECORD built-in is called to create a record, any triggers associated with the creation of a record (like WHEN-CREATE-RECORD) will be fired automatically.

The only code that would NOT be run is anything other than the CREATE_RECORD call in your KEY-CREREC trigger, if you have one.  To make sure that all code in the KEY-CREREC trigger is run, do this:

Item:    (your insert button)
Trigger: WHEN-BUTTON-PRESSED
Code:    DO_KEY('CREATE_RECORD');

Now whenever you press the button, your KEY-CREREC will fire (if you have one).  If you don't have a KEY-CREREC, then the standard CREATE_RECORD will be done.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
creativepresenceAuthor Commented:
lol. ok can i just to clear this up in my head as im having a blonde day, would you mind explaining the process to me?  I need a WHEN_CREATE_RECORD trigger on the data block? contaning what code? i do not have a KEY-CREREC trigger? should i have one & if so where & containing what?
Thank you.

0
 
andrewstCommented:
OK, let's back up a bit.  Forget about the WHEN-CREATE-RECORD trigger - you don't need it.

Just do this:

1) Create your button

2) Create a WHEN-BUTTON-PRESSED trigger associated with the button

3) In the WHEN-BUTTON-PRESSED trigger code just put the following line:

DO_KEY('CREATE_RECORD');

4) Save and run
0
 
creativepresenceAuthor Commented:
Hi Andrew, problem solved, but thanks.
0
 
andrewstCommented:
OK, let's back up a bit.  Forget about the WHEN-CREATE-RECORD trigger - you don't need it.

Just do this:

1) Create your button

2) Create a WHEN-BUTTON-PRESSED trigger associated with the button

3) In the WHEN-BUTTON-PRESSED trigger code just put the following line:

DO_KEY('CREATE_RECORD');

4) Save and run
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now