data transfer between two forms

hello

how can you transfer Field information from One form to another form.

bye

If this data is actuallly stored in the database, then you can simply fetch the data in form2.

But otherwise you can transfer variables, temporary records etc. by adding a function in form2.
This function could be called SetValues(), and should call for all values you want transferred as parameters.
In this function you assign the values from the parameters to Global Variables you have defined in form2.

In some event-trigger in form1, or by user action, call the new function in form2
Then call form2.RUNMODAL or form2.RUN, and the values sent will be available.

Hi Imran,

You can transfer data from one form to another using the RunFormLink property of the form variable.

Alternatively, you can also write a function with global variables which will store the required values from Form A and then when you call Form B you can retrieve those values and use them the way you like.

Please clear me with a simple exmple

Let us say i have a form FormA and this form has a field named RefarenceNummber which is tableA field and i want to display this field on formB.

formA is based on TableA and formB based on TableB .and formB also contains same field RefarenceNummber .

i want to populate formB field automatically at run time.

how can i do this

The best example for your question in Navision is Form 42, Sales Order Form.

Go to the design section and inside get into the Card MenuItem of Order. Here you’ll find that Customer Card form is linked to Sales Order form. In your case, link the form which you would like to open.

Go one step furthur, check the property of that Card MenuItem. In the RunFormLink property you’ll find something like this : No.=FIELD(Sell-to Customer No.). If you click on the assist edit button, you’ll find three columns. First column shows which field in the Customer table, is linked to the field in the third column, which is the Sales Header table. In your case, link the field between the table which you want in the above said manner.

I hope that should solve your problem.

It creates just a Relation between two form it displayes no data from one form to another form .

Hi Imran,

Here’s how you can do Data Transfer between two forms using CAL Code.

Setup is, I have two tables Table 1 and Table 2 and two forms, Form 1 and Form 2 which run on Table 1 and Table 2 respectively.

I have a button on Form 1 called Transfer. I keep my cursor on the field I want to be sent to Form 2 and then I press Transfer. The example which I’m showing here has Customer and Name fields in Table 1 and Cust Code and Cust Name fields in Table 2. Rec_Table2 is a record variable which refers to Table 2. 61101 is the ID of Form 2.

Rec_Table2.SETRANGE(Rec_Table2.“Cust Code”,Customer);
IF Rec_Table2.FINDFIRST THEN
BEGIN
Rec_Table2.“Cust Code” := Customer;
Rec_Table2.“Cust Name” := Name;
Rec_Table2.MODIFY;
END
ELSE
BEGIN

Rec_Table2.INIT;
Rec_Table2.“Cust Code” := Customer;
Rec_Table2.“Cust Name” := Name;
Rec_Table2.INSERT;
END;

Rec_Table2.RESET;
Rec_Table2.SETRANGE(Rec_Table2.“Cust Code”, Customer);
IF Rec_Table2.FINDFIRST THEN
FORM.RUN(61101,Rec_Table2);

This should be of some help to you.