Easy to Create, Easy to Change - Easy to use!


Deleting particular record(s) from a sub-form


Started by Kensington
Search
You will need to Sign In to be able to add or comment on the forum!

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?

Written by Kensington 02/10/13 at 12:42:41 Dataease [{8}]FIVE

Re:Deleting particular record(s) from a sub-form

Anyone there???

Written by Kensington 03/10/13 at 14:25:53 Dataease [{8}]FIVE

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

Written by Josef Vella 03/10/13 at 15:21:33 Dataease [{8}]FIVE

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.

Written by Kensington 03/10/13 at 16:00:35 Dataease [{8}]FIVE

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

Written by Surjo 04/10/13 at 02:34:29 Dataease [{8}]FIVE

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????

Written by Gregor Popp 06/10/13 at 21:28:15 Dataease [{8}]FIVE

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.

Written by Kensington 07/10/13 at 12:00:00 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:Deleting particular record(s) from a sub-form

Anyone there???

Written by Kensington 10/10/13 at 09:26:13 Dataease [{8}]FIVE

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

Written by Josef Vella 10/10/13 at 10:31:19 Services

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.

Written by DataEase 10/10/13 at 09:48:28 Dataease [{8}]FIVE

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?

Written by Kensington 10/10/13 at 10:59:10 Dataease [{8}]FIVE

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

Written by DataEase 10/10/13 at 12:02:41 Dataease [{8}]FIVE