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()
}
}