Normal Topic Looking for help on printing an alternate form (Read 928 times)
esgage
Junior Member
**
Offline


No personal text

Posts: 55
Joined: Dec 8th, 2005
Looking for help on printing an alternate form
Sep 7th, 2012 at 7:35pm
Print Post Print Post  
Hello:

I am trying to create a command button to do the following:
I am in one form, and I would like to have a button for example, that says "Print Shop Traveler". After the user pushes the button I would like it to go to the shop traveler form print the information on there and then go back to the same form they were just in. I have had this working for years, but need to rely on a field that says "print shop traveler Y/N" If they put a Y in that field and then push the button, I have the program to work to search for the Y on the retrieve spec open on the alternate form. It then allows them to print, but stays on that form. I have created a button that they push that goes back to the form they were in, but I would like to streamline and avoid the Y field because many times the workers forget to take it out. Please help if you can. Thanks as always!!
Kevin
ES Gage
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Looking for help on printing an alternate form
Reply #1 - Sep 7th, 2012 at 8:54pm
Print Post Print Post  
Instead of placing a "Y" in a field on the target form, is there another way to ID that record? Some sort of unique record number, or otherwise?

Also, are you printing an alternate form of the same database and record, or are you printing a record from a separate database?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
esgage
Junior Member
**
Offline


No personal text

Posts: 55
Joined: Dec 8th, 2005
Re: Looking for help on printing an alternate form
Reply #2 - Sep 10th, 2012 at 12:01pm
Print Post Print Post  
I think I kind of figured it out, but it really bogged it down in the test run in Sdesigner. To answer your question, it is the same database, and the same record, or set of retrieved records. I have many alternate forms on my design to do various stuff to save space and most times it is the same record. I currently have buttons the user presses to switch to an alternate form so they can, for example enter time and then check photos of a job (same record). I experimented this morning and when the user presses the print button, it will switch to the alternate form. At that point, using programming on form entry, it will print the record, and then the next line in programming had it switch back to the previous form. This seemed to work, but it really was slow. Is there a better way I am not thinking of?
Thanks
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Looking for help on printing an alternate form
Reply #3 - Sep 10th, 2012 at 12:31pm
Print Post Print Post  
That's the way I take care if it. I have this in the first form's "Print" button:
Code
Select All
var Success as int

// Save record
FormCommit("")

// Switch to printable form
If @Add
	Success = @SelectTreeItem("Add Data Menu!Switch to an Alternate Form!Printable EMPLOYER")
Else If @Update
	Success = @SelectTreeItem("Search Update Menu!Switch to an Alternate Form!Printable EMPLOYER") 



Then, I have this in the printable form's On Form Entry event:
Code
Select All
var Success as int

// Print the form
Success = @PrintAForm(0, 1, 1, 1, 28, 0, 0, 0, 0, 1, 1)

// Return to original form
If @Add
	Success = @SelectTreeItem("Add Data Menu!Switch to an Alternate Form!EMPLOYER")
Else If @Update
	Success = @SelectTreeItem("Search Update Menu!Switch to an Alternate Form!EMPLOYER")
 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
esgage
Junior Member
**
Offline


No personal text

Posts: 55
Joined: Dec 8th, 2005
Re: Looking for help on printing an alternate form
Reply #4 - Sep 10th, 2012 at 12:44pm
Print Post Print Post  
Carl:

Thanks for your help. A couple of more questions.
Is there a way this would work only if they push a button?
In other words, my workers may go into the job photo screen to view the photo, but may only want to print it from another form. If I do the on form entry method, it would always want to print.

In addition, sometimes I may want to use the @PrintAForm to print multiple retrieved records. Now using the method outlined above, it wants to print 1. How can I tell programming on form entry to differentiate between buttons pressed or versus wanting no printing at all?

Thanks!
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Looking for help on printing an alternate form
Reply #5 - Sep 10th, 2012 at 4:53pm
Print Post Print Post  
Hello Kevin

You can change Carl's code to do that with something like...

Code
Select All
Var Success as int

FormCommit("")
ClientLocalValue("PrintForm", "Current")
If @Add
	Success = @SelectTreeItem("Add Data Menu!Switch to an Alternate Form!Printable EMPLOYER")
Else If @Update
	Success = @SelectTreeItem("Search Update Menu!Switch to an Alternate Form!Printable EMPLOYER")
 



for printing only the current record and

Code
Select All
var Success as int

If @ClientLocalValue("PrintForm") <> "" Then
{
	// Print the form
	If @ClientLocalValue("PrintForm") = "Current" Then
	{
		Success = @PrintAForm(0, 1, 1, 1, 28, 0, 0, 0, 0, 1, 1)
	}
	Else If @ClientLocalValue("PrintForm") = "All" Then
	{
		Success = @PrintAForm(1, 1, 1, 1, 28, 0, 0, 0, 0, 1, 1)
	}

	ClientLocalValue("PrintForm", "")
	// Return to original form
	If @Add
		Success = @SelectTreeItem("Add Data Menu!Switch to an Alternate Form!EMPLOYER")
	Else If @Update
		Success = @SelectTreeItem("Search Update Menu!Switch to an Alternate Form!EMPLOYER")
} 



in on Form Entry. The Code to print all would be the same as the code to print 1 just with "All" in the ClientLocalValue() instead.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
esgage
Junior Member
**
Offline


No personal text

Posts: 55
Joined: Dec 8th, 2005
Re: Looking for help on printing an alternate form
Reply #6 - Sep 10th, 2012 at 7:26pm
Print Post Print Post  
Ray and Carl:

That worked perfectly! Thank you so much for your help. It saved me a lot of time.

Kevin
ES Gage
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Looking for help on printing an alternate form
Reply #7 - Sep 11th, 2012 at 1:34am
Print Post Print Post  
Ray,
Thanks for chiming in. I posted my message just before leaving for the day, and I didn't get back until a few minutes ago (9:30pm).


Kevin,
As Ray demonstrated, Sesame can be infinitely customized to suit just about whatever you need it to do. Smiley
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Looking for help on printing an alternate form
Reply #8 - Sep 11th, 2012 at 2:08pm
Print Post Print Post  
Not a problem at all Carl, and you are welcome Kevin.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged