How to insert value of textbox in Table

I have a Textbox.

Eg: Textbox1 := ‘Sagar’;

I want to insert the value of Textbox1 in the table named XYZ.

The sourceExpression of textbox is Textbox1.

Note: The value of Textbox1 is dynamic.

Textbox1 is a variable of type Code.

What did you try till now?

What is the sourcetable of your form?

As mentioned the name of the table using form is XYZ

So Where is the problem you are facing ???

The field in table corresponding to textbox is blank.

I have added Textbox1 in SourceExpn.

How to insert value in Texbox1 in table XYZ.

Eg: Table - XYZ

Field - Name

SourceExpn of Textbox : Name

The value of textbox is dynamic. So i created a variable Textbox1.

I am doing OnPush : Textbox1 := ‘Sagar’;

Now i want this Sagar in Name field of Table XYZ.

I am bit clear about the requirement.

You can write code on Onvalidate trigger or create one button and write a code on that

Anyone please reply if there is another solution.

I got the solution as below:

I created a new table Country with fields as below:

ID | Name

1 | India

2 | USA

SourceExpn of Textbox is set as Name of Country:

recCountry.RESET;
recCountry.SETRANGE(recCountry.Name,‘India’);
IF recCountry.FINDFIRST THEN
Status:= recCountry.Name;

CurrForm.UPDATE;

NOTE: I need to change only the field India,USA … in SETRANGE