Normal Topic [Solved] This code does not work. (Read 398 times)
drastixnz
Full Member
***
Offline


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
[Solved] This code does not work.
Feb 8th, 2008 at 1:44am
Print Post Print Post  
I have a subform called loan_information with three LEs on it
Load ID2
Payment Date
Payments

and a parent form with the following LEs on it
Loan ID1
Payment Date0
Payments0

and a button on the parent form which has the following code

ar n as Int
var vCount as Int
var vEdits as String
var vDeletes as String
var vChoice as String

If @Mode() < 2
{
Clear(Loan ID1, Payment Date0, Payments0)                                                //Clear the parent form
Label(ThisElement, "Add / Edit / Delete Payment")                                          //Labels button
vCount = @FormResultSetTotal("loan_information")                                          //Counts how many records in subform

If vCount = 1 Then
If @FormFieldValue("loan_information", "Loan ID2", 1) = "" Then
vCount = 0

For n = 1 to vCount
vEdits = @AppendStringArray(vEdits, "Edit a Payment/Edit Payment Rec# " + n)
vDeletes = @AppendStringArray(vDeletes, "Delete a Payment/Delete Payment Rec# " + n)

Next

PopupSelectPosition(4, @XPos(ThisElement), @YPos(ThisElement))
vChoice = @PopupMenu("Add a Payment;" + vEdits + ";" + vDeletes,"ADD, EDIT or DELETE A PAYMENT")
// PopupSelectPosition(0,123,123)

If vChoice = "Add a Payment"

Label(ThisElement, vChoice)
ForceRedraw()
ThrowFocus(Loan ID)
}
Else If @Instr(vChoice, "Edit") > 0 and @Len(@Num(vChoice)) > 0
{
Label(ThisElement, vChoice)
ForceRedraw()
Payment Date0 = @FormFieldValue("loan_information", "Payment Date", @Num(vChoice))
Payments0 = @FormFieldValue("loan_information", "Payments", @Num(vChoice))
Loan ID1 = @FormFieldValue("loan_information", "Loan ID2", @Num(vChoice))
ThrowFocus(Loan ID)

}
Else If @Instr(vChoice, "Delete") > 0 and @Len(@Num(vChoice)) > 0
{
Label(ThisElement, vChoice)
ForceRedraw()

// Uncomment the following lines for Sesame 2.0

If @Askuser("Are you sure you want to delete record# " + @Num(vChoice) + "?","","")
{
FormDeleteRecord("loan_information", @Num(vChoice))

// CalcDonations()
}
Label(ThisElement, "Add / Edit / Delete Payment")
ForceRedraw()
}


I have been on this issue for the past two days, the problum is the Add Record works, and the menu works, but when i select another option, i the menu it do not work.


Help please,
« Last Edit: Feb 8th, 2008 at 9:21pm by Hammer »  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: This ode does not work.
Reply #1 - Feb 8th, 2008 at 3:35am
Print Post Print Post  
Take a careful look at your curly braces. They don't seem to be in the right places. For example, I'd expect one after If vChoice = "Add a Payment"

I'm also not sure what the "Next" floating in the middle is meant to do.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
drastixnz
Full Member
***
Offline


A Newbie....

Posts: 146
Location: New Zealand
Joined: Nov 29th, 2006
Re: This ode does not work.
Reply #2 - Feb 8th, 2008 at 9:00pm
Print Post Print Post  
AAAAAAAAARRRRRRRRRRRGGGGGGGG!!!!!!!!!!!!!!!!!!!! two days of looking and all it was a "}" was missing


Thanks so much hammer it now works...
  
Back to top
IP Logged