Normal Topic Save & Continue button (Read 959 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Save & Continue button
Aug 31st, 2006 at 6:23pm
Print Post Print Post  
I had a nicely working "Save and Continue" button for a while, but found that when it was used during Update it would switch to Add mode.  What I really want is one that will continue to a new record while in Add mode, or advance to the next retrieved record if in Update mode, but won't advance into Extended mode if it reaches the last record while in Update.  So I've been Frankensteining pieces of code together that I've "borrowed" from other application I have on my disk.

This is what I've got.  The program editor is happy with it, but something is wrong because although it does save it does not advance.
Code
Select All
// Saves the record and moves to the next

IF @IsBlank(Code)   // Prevents saving of uncoded records
Then
	{
	 NotifyForm(1)
	 @MsgBox("Customer Code has not been assigned.","Please click ASSIGN CODE.","")
	}

Else IF @IsBlank(Company)    // Prevents saving of records with no Company Name
THEN
	{
	NotifyForm(1)
	@MsgBox("Customer Name cannot be blank.","","")
	ThrowFocus(Company)
	}

Else IF @Mode() = 1   // Prevents entering Extended Mode from Search-Update
THEN
	{
	IF @ResultSetCurrentPosition() = @ResultSetTotal()
	THEN
		{
		NotifyForm(2)
		}
	ELSE
		{
		NotifyForm(-2)
		}
	}

ELSE    // Saves and advances
	{
	NotifyForm(0)
	@Save
	} 


Could more experienced eyes take a look at this and tell me what I'm missing?  Thanks.
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Save & Continue button
Reply #1 - Aug 31st, 2006 at 7:38pm
Print Post Print Post  
Fixed!

Code
Select All
// Saves the record and moves to the next

var NextRecord as int


IF @IsBlank(Code)   // Prevents saving of uncoded records
Then
	{
	 NotifyForm(1)
	 @MsgBox("Customer Code has not been assigned.","Please click ASSIGN CODE.","")
	}

Else IF @IsBlank(Company)    // Prevents saving of records with no Company Name
THEN
	{
	NotifyForm(1)
	@MsgBox("Customer Name cannot be blank.","","")
	ThrowFocus(Company)
	}


ELSE If @Mode() = 1  // Saves and advances in Update mode, Prevents entering Extended Mode from Search-Update
THEN
	{
	IF @ResultSetCurrentPosition() = @ResultSetTotal()
	THEN
		{
		NotifyForm(2)
		}
	ELSE
		{
		NotifyForm(0)
		NextRecord = @selecttreeitem("Search Update Menu!Navigation!Save Record")
		NextRecord = @selecttreeitem("Search Update Menu!Navigation!Advance Record (F10)")
		}
	}


ELSE  If @Mode() = 0  // Saves and advances in Add mode
	{
	NotifyForm(0)
	NextRecord = @selecttreeitem("Add Data Menu!Navigation!Save Record")
	NextRecord = @selecttreeitem("Add data menu!Navigation!Advance Record (F10)")
	} 



Although I'm not actually sure if the "Save Record" items are necessary if the next one is the F10 command.

Had a heck of a time figuring out the Navigation commands, looking high and low all over designer for them.  Finally found them in Runtime.  And then, of course, I found them again right at the very beginning of the User Guide.  It's been a while since I've visited the front of that book.  I spend most of my time in the Index.  Still learning, I guess.  Gonna be a while.  Hope eveyone has patience with me.
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Save & Continue button
Reply #2 - Sep 6th, 2006 at 7:50pm
Print Post Print Post  
I wrote:
Quote:
Although I'm not actually sure if the "Save Record" items are necessary if the next one is the F10 command.

Can anyone tell me the answer to this?  Is a "Save Record" command necessary, or does the F10 do this anyway?  Thanks in advance.
  

**
Captain Infinity
Back to top
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Save & Continue button
Reply #3 - Sep 6th, 2006 at 8:22pm
Print Post Print Post  
Infinity,

F10 will save the record, so you don't need to call save and F10.

-Ben
  
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Save & Continue button
Reply #4 - Sep 6th, 2006 at 8:26pm
Print Post Print Post  
Thanks Ben!
  

**
Captain Infinity
Back to top
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Save & Continue button
Reply #5 - Sep 6th, 2006 at 8:27pm
Print Post Print Post  
You're welcome.
« Last Edit: Sep 8th, 2006 at 3:03pm by Ben »  
Back to top
IP Logged