Normal Topic Need some advice (Read 2352 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Need some advice
Nov 15th, 2004 at 10:14pm
Print Post Print Post  
I need some help:

From our Invoice form, I want to be able to CREATE a new record in our Contacts form and Xpost the customer data into it when the Invoice form is saved or Printed.

The xposting seems easy enough, but how do I create the new record needed to post the customer data without leaving the invoice?

I tried using a subform from Contacts and just type the customer data directly into the contacts database from the Invoice, which worked great but this is not a proper way to creat an invoice (becuase the customer info on an invoice should not change when the contact info changes).

Any help is GREATLY appreciated.

Thanks,
Steve
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Need some advice
Reply #1 - Nov 16th, 2004 at 12:39am
Print Post Print Post  
Steve,

If the Contacts form is in the same application, you could use @FormNewRecord(), but it only adds a new record if the Contacts form is open at the time. That can be taken care of with programming, with the use of @SelectTreeItem() to open the Contacts form in add mode.

Or if the Contact form is in a different application, you could use a technique that I have been using in Q&A for years. I keep some records in my target database that simply have "FREE" in the key value field. First, I XPOST to one of the "FREE" records, overwriting the "FREE" value with a new unique key value. Then I can XPOST to all the other fields using the new unique key value. When the XPOST fails to find a "FREE" record, the programming launches an additional Q&A session with an auto-run macro via @shell, which then adds more records and types FREE into the key value field.
  


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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need some advice
Reply #2 - Nov 16th, 2004 at 12:50am
Print Post Print Post  
Carl,

Thanks for your advice.  I'm surprised there isn't an easier way to create a new record without opening the DB?

Shouldn't @CreateNewRecord or @FormNewRecord do the trick, without having to open the DB? At the very least, can I just keep Contacts open on a tab and create and xpost as needed without having to 'goto' the tab?

There has to be a simpler way?

ps - Your Q&A technique is very creative. I'll keep it in mind.

Thanks!

Steve
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Need some advice
Reply #3 - Nov 16th, 2004 at 1:02am
Print Post Print Post  
Quote:
Shouldn't @CreateNewRecord or @FormNewRecord do the trick, without having to open the DB? At the very least, can I just keep Contacts open on a tab and create and xpost as needed without having to 'goto' the tab?

You don't have to goto (or even see) the Contacts form; it just needs to be open somewhere within Sesame. If Contacts is a subform of Invoice, that qualifies as being "open". So, you should be able to use @FormNewRecord().

  


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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need some advice
Reply #4 - Nov 16th, 2004 at 1:08am
Print Post Print Post  
OK! That sounds perfect! I'm glad we dont have to have it visibile on the screen or as a subform.

I appreciate your help!

Steve
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Need some advice
Reply #5 - Nov 16th, 2004 at 1:23am
Print Post Print Post  
I just realized what you meant by 'goto'. If you use @SelectTreeItem() to open Contacts, it will display the Contacts form. You can solve this by having a second  @SelectTreeItem() to get back to the Invoice form. Something like this should work:
Code
Select All
var success as Int

success = @SelectTreeItem("AppName!Forms!Search/Update!Contacts DB!Contacts Form")
success = @SelectTreeItem("AppName!Forms!Search/Update!Invoice DB!Invoice Form") 



I just tested it. It works good.

  


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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Need some advice
Reply #6 - Nov 16th, 2004 at 1:36am
Print Post Print Post  
One more consideration - you will also need to use another @SelectTreeItem() to save the new record in Contacts after all of the elements are filled using FormFieldValue() (instead of XPOST). Otherwise you would need to eventually go to the Contacts form by clicking on the tab at the bottom of the Sesame window, and manually saving the new record.
  


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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Need some advice
Reply #7 - Nov 17th, 2004 at 5:59am
Print Post Print Post  
Carl,

Thanks again for your help. I was able to use your technique to copy the contact info from the invoice form to the contacts form easily enough. I just I could do the same thing without having the form open in the background.

Maybe in a future version of sesame.

For now, we'll get by.

Thanks!

Steve
  
Back to top
IP Logged