Re: change a field value

From: Rick Bean (rgbean_at_unrealmelange-inc.com)
Date: 09/28/04


Date: Tue, 28 Sep 2004 14:52:40 -0400

Helen,
In VFP, the brackets ([]) are an alternative to quotes (" or ') for delineating a string. So [ABC] is the same as "ABC" or 'ABC'. It isn't the same as Access or SQL Server that uses []'s to signify a field name. Try:
specialwtvalue=str(10-Len(aminchar))
INSERT INTO sortorde (specialwt) VALUES (specialwtvalue)
=TABLEUPDATE(.T.,.F., 'sortorde')

As long specialwt is a character field of 10 of more characters this will work. If it is smaller, you may want to use the optional length on the STR() function or use the transform() function. e.g. For 5 characters:
specialwtvalue=str(10-Len(aminchar), 5)
specialwtvalue=transform(10-Len(aminchar), "99999")

Rick

"Helen123" <Helen123@discussions.microsoft.com> wrote in message news:29A2EE9F-7657-4CC4-BBFB-4ADA0E270B29@microsoft.com...
>I have a table with three fields, they are "aminchar","sortorder" and
> "specialwt". The field "specialwt"'s value was empty. Now i want to change
> its value based on the "aminchar" and "sortorder"'s value. I did the
> following code:
> specialwtvalue=str(10-Len(aminchar))
> INSERT INTO sortorde (specialwt) VALUES ([specialwtvalue])
> =TABLEUPDATE(.T.,.F., 'sortorde')
>
> The specialwtvalue is "7" or "8", but it only accept "specialwtvalue" like a
> string, not accept its value in second sentence "INSERT INTO....
> VALUE([specialwtvalue]). I don't know how to pass the value of specialwtvalue
> to it. Any suggestion, thanks!
>


Loading