Normal Topic Subforms with @save (Read 523 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Subforms with @save
Feb 16th, 2004 at 9:47pm
Print Post Print Post  
When I have a form with subforms and leave the main form to enter the subform is there a mechanism that could execute @save.

In my test application I have a form called basic that contains
Many elements housing Basic information
An invoice subform.
A line items subform.

I have logic that sets the record id in the basic database and adds that id into the invoice database when creating a new invoice and logic that assigns the invoice number  to that invoice and logic that adds that number into an element on the line items subform on each new line item..

My problem is that if I do not save the data immediately before entering the subform my values from the previous part of the form are not available for use in the subform.

I have tried putting @save in numerous spots but I get sporadic results.

My concept works perfect every time if I f10 then f9 and then enter the subform.

All my databases link ok together the big frustration is if I leave f10 un controlled, with auto dating or numbering or any other initial value I end up with tons of junk records. When I use logic like below to control addition of records it makes  saving confusing.

If @update and lastname = ""
then

if not @askuser("Did you want to add a new ","Patient Record","to The System?") then
Resultsetcurrentposition(@resultsetcurrentposition() -1)

or

If @Update and lastname = ""
{
@Msg("Returning you to previous record.")
ResultSetCurrentPosition(@ResultSetCurrentPosition() - 1)
}
I hope this is somewhat clear.

Any thoughts?
  

Team – Together Everyone Achieves More
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: Subforms with @save
Reply #1 - Feb 16th, 2004 at 10:57pm
Print Post Print Post  
Quote:
My problem is that if I do not save the data immediately before entering the subform my values from the previous part of the form are not available for use in the subform.


Bob, I think this value should be available to subform without saving the MainFrom record. This might not be working now as expected because of communication problem between MainForm and SubForm in in version 1.0.1.  I am also getting error when I try to get value in subform using the code mentioned below.

I tried out the following code in the MainForm and value available in the current record of MainForm without saving the record.

var n as Int
var vName as String

n = @FormResultSetCurrentPosition("Test1")
vName = @FormFieldValue("Test1", "Name", n)
Writeln (n + " is the current Position, and " + vName + " is the Name")

Where Test1 is the MainForm and Name is one of the elements in the MainForm.

Mark had given this code earlier stating that it might not work as well in version 1.0.1 but is working well in 1.0.2.  So, hang in there without going through fustrations until version 1.0.2 is out.




« Last Edit: Feb 17th, 2004 at 1:51pm by Bharat_Naik »  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Subforms with @save
Reply #2 - Feb 17th, 2004 at 2:46am
Print Post Print Post  
Thanks Bharat.

I will hang in there.

Some days are just tougher then others.  Sad
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged