>Hello:
>I have a form(A) that calls another form(B) for users to input
>client information. They search by sin number and in the valid of that text box there is code to search the client table if it's there and display, if it's not there the user must add the client(firstname,lastname and phone number)
>
>Form b has 5 textbox controls, 3 which use variables(csurname, cfirstname and cphone and 2(gidetail.sin, gidetail.result) are the fields in the table as the controlsource. These are saved and to display in a grid on Form A.
>
>When I add my first record everthing displays fine, when I add the second record, the values in the columns that use the fields as the contolsource are fine but the other columns(variables) display record
>2's name and phone#, if I add a third , rec # 1,2 &3 display the name entered for record 3's name....etc. So bascially the last record input on form B is what's displaying for all my records in the
>grid but just in the fields that use a variable as the controlsource,
>
>I've tried copying my data to an array and using this as the control
>source but I get the same result.
>
>In the valid of the textbox(csurname)I have the following:
>
>
>If thisform.text2.enabled = .t.
> replace client.surname with this.value
>this.refresh
>Endif
>
>Why is this changing all my records and placing the last
>record input in for all name's and phone number and keeping the other
>2 fields correct values?
>
>It is only a display problems as it is updating the table correctly.
>Any advice would be appreciated. THanks.
Sheena,
It's normal. It's like having n textboxes with same memvar as controlsource. Whatever the memvar value that would be displayed in column. You could use an array instead. ie:
select mytable.Title from myTable into array thisform.aTitles
thisform.mygrid.mycolumn.controlsource = "thisform.aTitles[recno(),1]"
IMHO better is using a calculated controlsource or cursor. For calculated, controlsource might be :
Thisform.GetThisRecSurname(gidetail.sin)
Cetin