Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concate fields...

Status
Not open for further replies.

gambhir

Programmer
Oct 17, 2000
15
US
I have a form that has several inputs.

How can I user a combination of those inputs(concatenate 3 of those) to create a new field.

So for e.g. three inputs might be LastName, DriverType, Age
The new field will be JonesCourier53

Thanks for any suggestions.

 
Leave ControlSource of these controls empty. In the InteractiveChange or Valid of each control (last name, driver type, age) put following code:

replace MyCursor.MyField with ;
rtrim(this.parent.txtLastName.Value) + ;
rtrim(this.parent.txtDriverType.Value) + ;
rtrim(this.parent.txtAge.Value) ;
in MyCursor

In the refresh method of these controls put code to extract each part from table field and assign it to the Value property of control.

Such binding is called "manual binding" and often used for case when usual binding by ControlSource property could not be used.

Hope this helped.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Hi!

I thought you just nee to save data in that form.
So make such thing, you just need in the Valid event of each of first 3 controls put code to assign value to the 4-th control:

this.parent.txtControl4.Value = ;
rtrim(this.parent.txtLastName.Value) + ;
rtrim(this.parent.txtDriverType.Value) + ;
rtrim(this.parent.txtAge.Value)

All controls should be bound using ControlSource property, however.

Thanks for your input. I am still a bit confused as to how to implement your solution

Let me briefly re-state my issue
A user inputs three fields on on a form. Those fields
are added to the VFP table.

Just as those fields are added, a 4th field should
also be added which adds the contents of the first 3
fields.

The first field is my autonumber "driverid" Integer
field
The second field is a driver "name" Character field
The third field is a driver "type" Character field

The fourth field should be "driverid"+"name"+"type"
So an end result should be someting like
343JonesCourier

Where is the InteractiveChange of each control?
I am a little confused as to the meaning of the
replace code listed below.
Where and what is the refresh method for these
controls?




Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top