Normal Topic Delete Subform problems in the code (Read 737 times)
Renato Piacenti
Member
*
Offline


No personal text

Posts: 48
Location: Manaus - Amazonas - Brazil
Joined: Jun 20th, 2005
Delete Subform problems in the code
Apr 6th, 2010 at 11:53am
Print Post Print Post  
Delete Subform problems in the code

Using the Application Data / Sample / CharityDonors noticed that the code for the option  Delete Donation does not work in Version 2.5.1 of Sesame.
Versions for 2.5.0 in the code works very well.
Any solution for this code to version 2.5.1?
Quote:
// Fill in Subform Information from the main form

Var n as Int
Var vCount as Int
Var vEdits as String
Var vDeletes as String
Var vChoice as String

If @Mode() < 2 Then
{
     Clear(Donation_Date, Amount, Type)
     Label(ThisElement, "Add / Edit / Delete Donation")
     vCount = @FormResultSetTotal("Donations")
     
     If vCount = 1 Then
     {
           If @FormFieldValue("Donations", "Donation_Date", 1) = "" Then
           {
                 vCount = 0
           }
     }
     
     For n = 1 to vCount
           vEdits   = @AppendStringArray(vEdits, "Edit a Donation/Edit Donation Rec# " + n)
           vDeletes = @AppendStringArray(vDeletes, "Delete a Donation/Delete Donation Rec# " + n)
     Next
     
     PopupSelectPosition(4, @XPos(ThisElement), @YPos(ThisElement))
     vChoice = @PopupMenu("Add a Donation;" + vEdits + ";" + vDeletes, "ADD, EDIT or DELETE A DONATION")
     PopupSelectPosition(0, 123, 123)
     
     If vChoice = "Add a Donation" Then
     {
           Label(ThisElement, vChoice)
           ForceRedraw()
           ThrowFocus(Donation_Date)
     }
     Else If ((@Instr(vChoice, "Edit") > 0) And (@Len(@Num(vChoice)) > 0)) Then
     {
           Label(ThisElement, vChoice)
           ForceRedraw()
           Donation_Date = @FormFieldVAlue("Donations", "Donation_Date", @Num(vChoice))
           Amount = @FormFieldVAlue("Donations", "Amount", @Num(vChoice))
           Type = @FormFieldVAlue("Donations", "Type", @Num(vChoice))
           ThrowFocus(Donation_Date)
     }
     Else If ((@Instr(vChoice, "Delete") > 0) And (@Len(@Num(vChoice)) > 0)) Then
     {
           Label(ThisElement, vChoice)
           ForceRedraw()
     
           If @Askuser("Are you sure you want to delete record# " + @Num(vChoice) + "?", "", "")
           {
                 FormDeleteRecord("Donations", @Num(vChoice))
                 FormCommit("Donations")
           }
           Label(ThisElement, "Add / Edit / Delete Donation")
           ForceRedraw()
     }
}
  

Renato Piacenti&&Manaus Amazonas Brazil&&Aqui a Floresta esta sendo preservada.&&Preserve a sua tamb�m.
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Delete Subform problems in the code
Reply #1 - Apr 6th, 2010 at 1:14pm
Print Post Print Post  
Hello Renato,

The Delete function should work for all but the first record. The next version of Sesame will have a fix in it to repair this behavior.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Renato Piacenti
Member
*
Offline


No personal text

Posts: 48
Location: Manaus - Amazonas - Brazil
Joined: Jun 20th, 2005
Re: Delete Subform problems in the code
Reply #2 - Apr 6th, 2010 at 1:56pm
Print Post Print Post  
Thanks Ray
I will return to the Sesame 2.5 and wait for the repairs to 2.5.1.
  

Renato Piacenti&&Manaus Amazonas Brazil&&Aqui a Floresta esta sendo preservada.&&Preserve a sua tamb�m.
Back to top
 
IP Logged
 
Renato Piacenti
Member
*
Offline


No personal text

Posts: 48
Location: Manaus - Amazonas - Brazil
Joined: Jun 20th, 2005
Re: Delete Subform problems in the code
Reply #3 - Jun 10th, 2010 at 12:33am
Print Post Print Post  
The problem is solved in version 2.5.2.
Thanks  Wink
  

Renato Piacenti&&Manaus Amazonas Brazil&&Aqui a Floresta esta sendo preservada.&&Preserve a sua tamb�m.
Back to top
 
IP Logged