Deleting particular record(s) from a sub-form
Deleting particular record(s) from a sub-form
In a form with sub-form (for-example order/order lines) I want to delete lines in the sub-form. I have added a button on the sub-form lines with Action "Record Delete". However when you choose this it asks what do you want to delete, main form or sub-form? If you choose sub-form nothing happens but when you save the form the line disappears from the sub-form.
How can we handle deleteing of records in a sub-form properly?
Re:Deleting particular record(s) from a sub-form
Anyone there???
Re:Deleting particular record(s) from a sub-form
Hi
Place a button on the sub-form.
Button Action: Execute Function / Derivation
Function:
RecordDelete() + Keystrokes(" S_tab_enter") + RecordSave()
1. RecordDelete ....deletes the record
2, Keystrokes....automate the choice for subform and enter
3. RecordSave....to save and remove the line from the subform
Kind regards
Josef
Re:Re:Deleting particular record(s) from a sub-form
Thanks for the reply.
RecordDelete() + Keystrokes(" S_tab_enter") + RecordSave() Gives an error saying "invalid keystrock _tab_enter"
I have tried changing it to
RecordDelete() +Keystrokes(" S(_tab)(_enter)") + RecordSave()
but this doesn't work even though i don't get an error.
Re:Re:Re:Deleting particular record(s) from a sub-form
Hi,
Instead of Keystrokes(" S_tab_enter"), you should use Keystrokes("S _enter"). (put a space between S and _enter).
So the function should be:
RecordDelete() + Keystrokes("S _enter") + RecordSave()
If you want, you can put a confirmation dialog first before you delete the record, i.e:
if ( {some sub-form field} = blank , blank ,
if ( keystrokes ( "_tab" ) + message ( "Are you sure you want to delete this item?" , "Wait a mo..." , 4 , 4 , 0 ) = 7 , recorddelete () + keystrokes ( "s _enter" ) , blank ) )
Then you can manually save the record.
Best Regards
Re:Re:Re:Re:Deleting particular record(s) from a sub-form
Hi all
Surjo that works really great , I still have one more annoying item..
as we fill in the data of the subform tabbing across, the user inadvertently presses the delete button, the pause and question "do you want to delete" certainly helps. Its still annoying that the button is pressed as we use the tab or enter key to move from field to field.
I have tried using the Set Tab Order and not assigning a number to the delete button but that doesn't work.
Any more ideas out there????
Re:Re:Re:Re:Deleting particular record(s) from a sub-form
When I try to execute the expression I get the following error message:
I think the Message() function is generating the error.
Re:Re:Re:Re:Re:Deleting particular record(s) from a sub-form
Anyone there???
Re:Re:Re:Re:Re:Deleting particular record(s) from a sub-form
Hi
What you need is an event, that when click enter on the data-entry field it will automatically move you to the next line of the sub form.
This can be achieved by setting an OML with Keystrokes (_Tab).....so what happens it will in all cases exclude access to the delete button.
Regards
Josef
Re:Re:Re:Re:Re:Re:Deleting particular record(s) from a sub-form
Have you checked that the CDFS are defined in you app?
Try to put the formula in a field derivation instead, then you will be able to debug by removing bits and see when it is accepted.
Re:Re:Re:Re:Re:Re:Re:Deleting particular record(s) from a sub-form
Message function is there but looking at it has wrong number of arguments! Do you think I need to re-install Dataease?
Re:Re:Re:Re:Re:Re:Re:Re:Deleting particular record(s) from a sub-form
The CDF definition is in the application so Re-installing DataEase won't help.
Just fill in the correct information in the CDF record.
Cunftion Name: Message
Description: Custom Message Dialog & Processing
CDF Library: MsgBox.DLL
Returntype: Int
Param1:Text Message String
Param2: Caption Title String
Param3: Icon DisplayI Int
Param4: Button Selection Int
Param5: Beep Sound Int