Normal Topic Subform details (Read 821 times)
nateboone
Junior Member
**
Offline



Posts: 54
Joined: Dec 19th, 2006
Subform details
Dec 20th, 2006 at 7:50pm
Print Post Print Post  
I have a "Copy" button which copies current donor information on my Parent form to a "Gift History" subform using the following relevant programming:

var nn as int

nn = @formnewrecord("Gift History")

formfieldvalue("Gift History", "LE0", nn, receipt date)
formfieldvalue("Gift History", "Gift", nn, current gift)
formfieldvalue("Gift History", "Check #", nn, check number1)
formfieldvalue("Gift History", "Receipt Name", nn, receipt name)
formfieldvalue("Gift History", "Receipt #0", nn, nextNumStr)

For first time donors, (ie no previous entries in the subform for an individual parent form, I'm using natural linking), an additional blank record is added.  If I click on this record or leave the parent form and come back (F10, F9), the blank record records the date but everything else remains blank.  If there are already records on the subform however, this isn't a problem.

Any ideas about this?

I appreciate y'alls help...  just working on a little project for my parents over Christmas break.   Smiley
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Subform details
Reply #1 - Dec 20th, 2006 at 8:05pm
Print Post Print Post  
Try something like this:
Code
Select All
var vRec as Int

    vRec = 1
    If @Len(@FormFieldValue("Gift History", "LE0", 1)) > 0
    {
	  vRec = @FormNewRecord("Gift History")
    }
    . . .
 



Note: Edited to fix condition.
  

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



Posts: 54
Joined: Dec 19th, 2006
Re: Subform details
Reply #2 - Dec 20th, 2006 at 8:55pm
Print Post Print Post  
Sorry, no go, same result.

I tried:

If @Len(@FormFieldValue("Gift History", LE0, 1)) = 0
{
     vRec = 1
}
else
{
     vRec = @FormNewRecord("Gift History")
}

which solved the blank space for the first record problem, but doesn't allow additional records to be added.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Subform details
Reply #3 - Dec 20th, 2006 at 9:05pm
Print Post Print Post  
Nateboone,

You need the quotes around "LE0". Without the quotes, it is looking for a field in the subform named whatever is typed into the LE0 element on the parent form.
  

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



Posts: 54
Joined: Dec 19th, 2006
Re: Subform details
Reply #4 - Dec 20th, 2006 at 10:22pm
Print Post Print Post  
Works great!  Thanks!
  
Back to top
 
IP Logged