Normal Topic help programming @XResultSet.. (Read 520 times)
hc
Member
*
Offline



Posts: 2
Joined: Mar 24th, 2010
help programming @XResultSet..
Mar 24th, 2010 at 2:18pm
Print Post Print Post  
I need your help to program my "inven" form.

I have an application with "inven.db" database with label & field name "suppl_id" and with another label & field
name "supplier"

Another application with "suppl.db" database with label & field name "suppl_id" and with another label & field
name "supplier".

The datafield are "text" field types and both applications are located in the directory "C:\sesame2\data\".
Other fields not discussed here.

How do you program the "inven" form so when you enter or change a value in the "suppl_id" field (on exit field
element) to lookup the record with de same "suppl_id" value in "suppl.db" and fetch the value of "supplier" and
input this value in the "supplier" field of "inven.db". Code must run in both "add" and "update" mode.
  
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: help programming @XResultSet..
Reply #1 - Mar 24th, 2010 at 2:45pm
Print Post Print Post  
Hello,

Try the following code in the On Element Change event of the suppl_id element.

Code
Select All
Var vRS as Int
If @IsBlank(suppl_id) = False Then
{
	vRS = @XResultSetSearch("C:\Sesame\Data\Suppl.db", "Suppl", 0, 2, "!suppl_id=" + suppl_id)
	If vRS>= 0 Then
	{
	    supplier = @XResultSetValue(vRS, "supplier")
	    XResultSetClose(vRS)
	}
	Else
	{
	    @MsgBox("Error getting Supplier record from Suppl.db", "", "")
	}
} 



-Ray
  

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



Posts: 2
Joined: Mar 24th, 2010
Re: help programming @XResultSet..
Reply #2 - Mar 24th, 2010 at 4:18pm
Print Post Print Post  
Works......Thanks Ray.
  
Back to top
 
IP Logged