The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
How To pass data between forms
Posted: 14 May 07 4:30 PM
|
fiogf49gjkf0d I need a lookup form that will allow me to lookup data based on several different fields. i.e. Name, address, phone, Invoice Number, Date, ...
I also need to launch the new lookup form as a child form and then when the user selects the correct record I need to return the record key to the parent form.
I have created the search from and I can load the form but I don't know how to pass the record key back to the parent.
Is this possible? Can anyone help?
|
|
|
|
Re: How To pass data between forms
Posted: 15 May 07 9:19 AM
|
fiogf49gjkf0d Well, there are really two decent ways to do this, and which one you use depends on how you launch the form. How do you get the form to popup? And which version of SalesLogix do you use? |
|
|
|
Re: How To pass data between forms
Posted: 15 May 07 10:11 AM
|
fiogf49gjkf0d I'm using Versions 7.0
My custom lookup/search form is a Data Form. and here is the code to launch the form:
Dim Frm Dim objDetail
set frm = application.MainViews.Add("Personal:C_InvoiceLookup", 2, True) 'DNL
Frm.Caption = Application.Translator.Localize("Lookup Invoice") Set objDetail = Frm.DetailsView objDetail.chbxBillTo.Checked = True
frm.show
|
|
|
|
Re: How To pass data between forms
Posted: 15 May 07 11:17 AM
|
fiogf49gjkf0d There are a bunch of examples in SalesLogix that show how to retrieve information from forms that are displayed in this fashion. To make yours work, you would just need to add a line or two right after the "frm.show":
'Use this to grab the value from an object on the form: theValueIWant = objDetail.txtMyTextBox.Text
'Use this to grab the value from a variable in the code behind the form: theValueIWant = objDetail.Script.MyVariable
Set Frm = Nothing 'A good practice to kill the memory used for your form Set objDetail = Nothing
That should do it. Give it a try and let us know how it goes.
Jeff |
|
|
|
Re: How To pass data between forms
Posted: 15 May 07 11:41 AM
|
fiogf49gjkf0d Thanks that worked to pass back or retrieve the value at the time of the form load.
How do I get the calling form to stop the execution of code and wait until the child form is close before continuing on?
For example the entire code below is executed before the child form "Frm" is close. I need the value after the child form closes:
Frm.show theValueIWant = objDetail.txtMyTextBox.Text
Is there a way to load the child form in such a way that the parent form's code stops executing until the child is closed?
Currently I’m using: set frm = application.MainViews.Add("Personal:C_InvoiceLookup", 2, True)
|
|
|
|
Re: How To pass data between forms
Posted: 15 May 07 11:48 AM
|
fiogf49gjkf0d Hmm - interesting - I didn't know that would happen. The way it is shown in SalesLogix, and the way I do it, is to change the following code:
Frm.show theValueIWant = objDetail.txtMyTextBox.Text
To:
If Frm.ShowModal = mrOK Then theValueIWant = objDetail.txtMyTextBox.Text End If
That tells SalesLogix you are waiting for the user to either click OK or cancel. Also, this is convenient because you won't be setting any new values if the user does indeed cancel whatever they did on the popped up form. |
|
|
|
Re: How To pass data between forms
Posted: 15 May 07 11:48 AM
|
fiogf49gjkf0d Originally posted by Dean
How do I get the calling form to stop the execution of code and wait until the child form is close before continuing on? |
|
Change frm.Show to frm.ShowModal
-Ryan |
|
|
| |
|
Re: How To pass data between forms
Posted: 15 May 07 1:16 PM
|
fiogf49gjkf0d Be aware that Manage Forms don't default to mrOK. You have to specifically link their buttons to the correct Form.ModalResult property, or at least this was the norm in 6.x. I've always believed the forms should behave identically but since it generally isn't happening yet, I have a codebase that "makes it so". |
|
|
|