>I am new to VFP, please help!! I can't seem to get the value in register.txtcustid.value in the program below in the table. On a form is there something different about typing data in the text box vs storing data in it programmatically. Also, the field the value should be stored to in the table is the primary key. I don't know if that is prohibiting the field from accepting the data. I have tried using Replace and Insert Into neither seems to work. The program below is where I generate the value for the field. I can see the proper value in the text box but it won't store to the table.
>
>local nSuffix, cInitials
>
>cInitials = Left(register.txtFname.value,2) +;
> Left(register.txtlname.value,2)
>nSuffix = 0
>
>Locate for cust.custid = cInitials
> Do While Found()
> nSuffix = nSuffix + 1
> cInitials = Left(cInitials,4) + Alltrim(Str(nSuffix))
> Continue
> Enddo
>register.txtcustid.value = cInitials
Eric,
First do not use object reference starting with formname (I think register is form name). While it works here it's likely to bomb when you have another instance of the form. thisform.txtCustId is a better one.
Controlsource is empty as I get. Insert is not inserting the record and no error message makes me think you use buffering and do not tableupdate (replace might be issued at eof too).
Cetin