Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Auto typing in subforms (Read 3370 times)
John_Y_Cannuck
Junior Member
**
Offline


decidedly un-geek!

Posts: 97
Location: Lindsay Ontario Canada
Joined: Mar 8th, 2004
Auto typing in subforms
Mar 7th, 2005 at 3:57pm
Print Post Print Post  
In add data, Can I get some of my LEs to auto type in duplicate LE's in the subform?
I need to maintain the usability of the individual databases, thus, I need these duplicate fields.

eg Last name, First Name, address, Range, Lot, Section. There may be a few more.
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Auto typing in subforms
Reply #1 - Mar 7th, 2005 at 6:14pm
Print Post Print Post  
This is an example of copying information from a Purchase Order Parent form into POLines subform;
Put this into the programming for the subform On Form Entry:
Code
Select All
IF @ISNEW THEN {
VendorNumber  = @FORMFIELDVALUE("frmPurchaseOrders", "VendorNumber",0)
PurchaseOrder = @FORMFIELDVALUE("frmPurchaseOrders", "PurchaseOrder",0)
PoDate	  = @FORMFIELDVALUE("frmPurchaseOrders", "PurchaseOrderDate",0)
DueDate	 = @FORMFIELDVALUE("frmPurchaseOrders", "DeliveryDate",0)
PromiseDate   = DueDate
} 



This copies the Vendor ID, PO Number, PO Date, PO Due Date into matching Read Only LEs on the subform.  It also makes a subform LE named Promise Date the same value as the original Due Date.  This LE is not Read Only.  It can be updated if the Vendor needs to change the delivery date, but the original Due Date is retained to measure vendor performance against the original Due Date.

« Last Edit: Mar 24th, 2005 at 11:53pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
John_Y_Cannuck
Junior Member
**
Offline


decidedly un-geek!

Posts: 97
Location: Lindsay Ontario Canada
Joined: Mar 8th, 2004
Re: Auto typing in subforms
Reply #2 - Mar 7th, 2005 at 6:43pm
Print Post Print Post  
Much apreciated, I'll give that a shot.
  
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Auto typing in subforms
Reply #3 - Mar 24th, 2005 at 6:32pm
Print Post Print Post  
I too have the same question and after reading the book with mind numbing dilagence I have yet to grasp the concept. I understand the IF @ISNEW THEN {  part its the , in my case the Info LE on the sub form = Company name LE on the parent part.
  

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: Auto typing in subforms
Reply #4 - Mar 24th, 2005 at 6:50pm
Print Post Print Post  
got it,  anychance they are going to put in a spell chcker for code? I feel really slow today. Roll Eyes
  

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
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Auto typing in subforms
Reply #5 - Mar 24th, 2005 at 6:52pm
Print Post Print Post  
If I understand correctly you have an INFO element on a subform that you want to fill with the Company Name on the parent form?

Put this into the programming for the subform On Form Entry:
Code
Select All
InfoElement = @FORMFIELDVALUE("dispatch", "Company Name",0) 



(Edited to include correct form and element names from subsequent message)
« Last Edit: Mar 24th, 2005 at 11:56pm by Bob_Hansen »  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Auto typing in subforms
Reply #6 - Mar 24th, 2005 at 7:03pm
Print Post Print Post  
I used this
IF @ISNEW THEN {
Info  = @FormFieldValue("dispatch", "Company Name",info)
}

I kept getting errors on formfieldvalue the other way, is it the same?
  

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: Auto typing in subforms
Reply #7 - Mar 24th, 2005 at 11:41pm
Print Post Print Post  
yeah, im not doing something right. I would like to have the subform filled out by the parent form without going into the subform. FormFieldValue goes from parent to subform and @formfiledvalue goes from subform to parent? am I gettting that right?
  

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
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Auto typing in subforms
Reply #8 - Mar 25th, 2005 at 12:00am
Print Post Print Post  
Change FROM: Quote:
IF @ISNEW THEN { 
Info  = @FormFieldValue("dispatch", "Company Name",info
}
TO: Quote:
IF @ISNEW THEN { 
Info  = @FormFieldValue("dispatch", "Company Name",0
}
The "0" represents a single record in a record set.  "0" is the current record.
----------------------------------------------
The code above is executed when the subform is opened.

Your recent message says that you do not want to enter the subform.

In that case, try the following code in the parent form, (possibly in the Company Name element triggered on the ElementChanged event?):
Code
Select All
FormFieldValue("SubForm","Info",0,Company Name) 

This only updates the element field of the current record in the subform.  If you want to put this into multiple records in the subform then you would have to put this line into a loop.


(See pages 171,172 of Sesame Programming Guide).
----------------------------------------------------------
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Auto typing in subforms
Reply #9 - Mar 25th, 2005 at 3:45am
Print Post Print Post  
nuttin, i even checked the spelling a dozen times. bright side is it didnt error me. page 151 uses a 1 so I tried that too, in  a reconsiled db btw. not going to let it get the better of me.
  

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
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Auto typing in subforms
Reply #10 - Mar 25th, 2005 at 5:39am
Print Post Print Post  
Make sure you are putting this in the MAIN FORM, and don't use @IsNew just while you test it, to make sure nothing is stopping it from executing. The following is actual working code that I cut & pasted here, so it's accurate. (Don't forget the quotes around the 1st two parameters. Also, make sure you are using the layout element's name, not the label.)

Code
Select All
FormFieldValue("Transactions", "Trans Date", 1, Check Date)
 


"Transactions" = The name of the layout that the subform element (on the main form) is bound to. Check this by opening your MAIN FORM layout in Designer, clicking the "Other" tab in Property Viewer, and then clicking on the subform element. In the Property Viewer, check the name after "Bound To" (3rd line). This is the name that should replace Transactions in the example above.

"Trans Date" = Name of SUBFORM element you want to fill.

1 = Which subform in set.

Check Date = Name of MAIN FORM element data source.
  


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


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Auto typing in subforms
Reply #11 - Mar 25th, 2005 at 4:28pm
Print Post Print Post  
still nuttin, spelling and names are correct. Question in property viewer it shows the subform element line 4 (bound to type - Form) is that correct? it is a suborm and shows up as a subform in the design menu
  

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: Auto typing in subforms
Reply #12 - Mar 25th, 2005 at 4:54pm
Print Post Print Post  
Thank you Bob and Carl for your help on this project. Both your explanations were very helpful. It is working great, now on to the next project! Grin
  

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
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Auto typing in subforms
Reply #13 - Mar 26th, 2005 at 4:15pm
Print Post Print Post  
Just Curious,

What fixed the problem? Do you know what made the difference?
  


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


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: Auto typing in subforms
Reply #14 - Mar 27th, 2005 at 2:26am
Print Post Print Post  
It was late I was sleepy and I put the “good” code in form exit and not on element exit. No excuse was not paying attn. Thank you for you time on this with me. It was not a waste. Another lesson learned
  

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
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print