Link to home
Start Free TrialLog in
Avatar of DFIM
DFIM

asked on

How do I get an Oracle form to open in edit mode - editing selected records?

I have a form that I created in Oracle Form Builder.  I want the form to open in edit mode rather than add mode.  Before the form opens, I have a form that captures two pieces of data and creates global variables. When I open the form, I want it to get the records that are associated with those two global variables; populate the form with that specific record and let the user edit that form.  Using a cursor, I can get the form to populate - but when I change the data and save it - it creates a new record, rather than changing the current one.  
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
kretschmar's solution will work for sure!

alternativly you could place the code

set_block_property('BLOCKNAME', DEFAULT_WHERE, 'somefield = :global.VarName);

into the PRE-QUERY trigger. so you'll be sure that only these records are displayed if the user enters an EXECUTE-QUERY inside of the form manually.
Avatar of DFIM
DFIM

ASKER

I will try it as soon as I get to work.  Thank you so much!
Avatar of DFIM

ASKER

This code is very close to what I need, and I can tell that it is going to work.  I hate to seem like the beginner that I am, but I can't get it to recognize two parameters instead of just one.  Does someone know the trick?

set_block_property('BLOCKNAME', DEFAULT_WHERE, 'somefield = :global.VarName);
go_block('BLOCKNAME');
execute_query;

I have tried
DEFAULT_WHERE, 'somefield = :global.VarName1' AND 'somefield = :global.VarName2';

DEFAULT_WHERE, 'somefield = :global.VarName1' and DEFAULT_WHERE, 'somefield = :global.VarName2'

set_block_property('BLOCKNAME', DEFAULT_WHERE, 'somefield = :global.VarName1);
set_block_property('BLOCKNAME', DEFAULT_WHERE, 'somefield = :global.VarName2);

all are close - but none bring me only the records that are associated with those variables.
Avatar of DFIM

ASKER

This was a great solution.  I needed two variables instead of one - but figured that out after playing with it for a while.  I have worked on this all week.  Thanks so much for your help.