Normal Topic @FormNewRecord ( ) command problem (Read 406 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
@FormNewRecord ( ) command problem
Feb 29th, 2012 at 3:28pm
Print Post Print Post  
Code
Select All
nn = @FormNewRecord ("Documents")
								WriteLn ("The value on nn = " + @Str (nn) )




								//WriteLN ("vLoop = " + @str (vLoop))
								//WriteLN ("nn = " + @str (nn))

								FormFieldValue ("Documents", "RecNumber", nn, vRecNumber)
								FormFieldValue ("Documents", "DateAdded", nn, vDateAdded)
								FormFieldValue ("Documents", "Chart", nn, Chart)
								FormFieldValue ("Documents", "Description", nn, vDescription)
								FormFieldValue ("Documents", "View", nn, vView)
								FormFieldValue ("Documents", "FileName", nn, vFileName)
								FormFieldValue ("Documents", "Key", nn, vKey)

								Formcommit ("Documents")
 



The above command seems to return value of nn to @FormResultSetTotal ( ) instead of @FormResultSetTotal ( ) + 1.   And because of that it overwrite the last subrecord of the form while creating new record. Is there something I am doing wrong? Is there some a work-around?

I am using ver 2.5.2
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @FormNewRecord ( ) command problem
Reply #1 - Feb 29th, 2012 at 5:07pm
Print Post Print Post  
Do you have any NotifyForm flags set for that form? If so, you may be preventing the form from advancing. That's my favorite thing to forget about when I write this kind of code.  Smiley
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: @FormNewRecord ( ) command problem
Reply #2 - Feb 29th, 2012 at 6:53pm
Print Post Print Post  
Hi Erika,

You are genius!!! I would have never ever thought about that in my wildest dream.

Yes, I have following code in Global code:

//Prevent Extend Mode

If @Mode() <> 0 Then
{
     NotifyForm(7)
}

I have that to make sure that no record is added through Standalone form. I will use standalone form condition to achieve my objective.

I removed that and now it works fine. Thanks.
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: @FormNewRecord ( ) command problem
Reply #3 - Feb 29th, 2012 at 7:04pm
Print Post Print Post  
Bharat_Naik wrote on Feb 29th, 2012 at 6:53pm:
You are genius!!! I would have never ever thought about that in my wildest dream.


If by "genius" you mean that I've made this exact mistake a dozen times, then yes, I am a genius.

You don't need to remove the code form your form. You just need to wrap your other code in a clear/reset set of instructions. Something like:

FormNotifyForm("Documents", -7)
// Do stuff
FormNotifyForm("Documents", 7)
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged