Normal Topic [Solved] Save Record and Close Form question (Read 996 times)
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
[Solved] Save Record and Close Form question
Sep 29th, 2007 at 7:26pm
Print Post Print Post  
Ok, I have read the threads on select tree item and how you cant use "Save Record and Close Form (Shift-F10)" my issue is is there another way to perform THAT task beside the "@save then @exit" or formcommit "" ?

Because they do not function the same as shift f10 on the "on form exit" programing.
Yes, I'm trying to use a "save and exit" button on the form to update another database on form exit programing, if thats the problem does anyone have any other ideas?

I'm looking to update a "vendors" database from a "purchase order" database by xposting the date from the po to a date field on the vendors database called "last time used" keeps track of the last time I used that vendor. I also have this same thing for a "customer" database and "Dispatch" database that is not working very well either. But it works great in search and update mode! go figure.

Thank you for any advice. oh yeah it ver 1.1.5 because I'm STILL trying to learn the whole merge print thing and my present programing uses "print from to default (no background)" ALOT which 2.0 wont do

Sorry it sounded like I was whinning, I like 2.0 ALOT too.

Flip
« Last Edit: Oct 1st, 2007 at 9:38pm by Hammer »  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Save Record and Close Form (Shift-F10) questio
Reply #1 - Sep 29th, 2007 at 7:30pm
Print Post Print Post  
FlipGilbert wrote on Sep 29th, 2007 at 7:26pm:
  Because they do not function the same as shift f10 on the "on form exit" programing.
Yes, I'm trying to use a "save and exit" button on the form to update another database on form exit programing, if thats the problem does anyone have any other ideas?

The fact that you are in the button event prevents the On Form Exit event from running. To make happy:

Put the relevant portion of your On Form Exit code in a subroutine in GLOBAL CODE.
Call the subroutine On Form Exit.
Call the subroutine from your Save and Exit button.
Code
Select All
@Save
DoPostingStuff()
@Exit 




Quote:
Thank you for any advice. oh yeah it ver 1.1.5 because I'm STILL trying to learn the whole merge print thing and my present programing uses "print from to default (no background)" ALOT which 2.0 wont do

It won't do that? I see all the options for it to do that...
  

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


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Save Record and Close Form (Shift-F10) questio
Reply #2 - Sep 29th, 2007 at 7:41pm
Print Post Print Post  
Thank you Erika,
I kinda had the feeling I was trying to get to the elephants teeth from the wrong end.
Always greatful.
Flip
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Save Record and Close Form (Shift-F10) questio
Reply #3 - Sep 29th, 2007 at 9:34pm
Print Post Print Post  
It's looking like this..

Subroutine On_Form_Exit( )

If @UpDate
     {
           @Save
           If odate > Date_Post
                 {
                       Xpost(@fn,oname,"vendors!vname", odate,"VLU","")
                       Xpost(@fn,oname,"vendors!vname", opo,"po #","")
                 }

           @exit
     }
If @Add and @Isblank(oname)
     {
           @exit
     }
If @add
     {
           
           @save
           If odate > Date_Post
                 {
                       Xpost(@fn,oname,"vendors!vname", odate,"VLU","")
                       Xpost(@fn,oname,"vendors!vname", opo,"po #","")
                 }

           @exit
     }

End Subroutine

The save and exit part works well but its not posting the data...
Is "  " or blank,  less than a date? example in the above code If Date_Post is blank and odate is not it should post (if I have spelled everything right and have all the ducks where they are supposed to be)
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Save Record and Close Form (Shift-F10) questio
Reply #4 - Oct 1st, 2007 at 3:12pm
Print Post Print Post  
Hello FlipGilbert,
Copy the following sections of programming into your application.

Section: Global Code
Code
Select All
Subroutine On_Form_Exit( )
var vPath as String
var vSelect as Int

//==========================
// Set vPath
//==========================

If @Update then
   {
	vPath = "Search Update Menu!Navigation!Save Record"
   }

If @Add then
   {
	vPath = "Add Data Menu!Navigation!Save Record"
   }

//==========================
// If in Update mode or Add mode
//==========================

If (@Update) or (@Add and Not(@IsBlank(oname)))
     {
	    vSelect = @SelectTreeItem(vPath)
	    If odate > Date_Path
		     {
			     Xpost(@fn,oname,"vendors!vname", odate,"VLU","")
			     Xpost(@fn,oname,"vendors!vname", opo,"po #","")
		     }
	    @exit
     }

//==========================
// If in Add mode and "oname" is blank
//==========================

If (@Add and @Isblank(oname))
     {
	     @exit
     }


End Subroutine  



Section: Command Button - On Element Entry
Code
Select All
On_Form_Exit() 



Section: Form - On Form Exit
Code
Select All
On_Form_Exit() 

  
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Save Record and Close Form (Shift-F10) questio
Reply #5 - Oct 1st, 2007 at 7:20pm
Print Post Print Post  
Works Great! Thank you for your help Ben and Erika. And Ben, I have taken note of your very clean and most helpful explanations in code writing and plan on using more of it in my future code. I might even go back and redo some before I forget what it does!
simple fast and effective, I have been schooled yet again.
Best regards.
Flip
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged