Plz i wont to know what is the wrong in this statement
Dim SQL as string
SQL = "update TBL_TEST_LIB set FEES='" & "' ,fees'" - AdjustAmount.Text & "'"
CN.Execute SQL
Printable View
Plz i wont to know what is the wrong in this statement
Dim SQL as string
SQL = "update TBL_TEST_LIB set FEES='" & "' ,fees'" - AdjustAmount.Text & "'"
CN.Execute SQL
Assuming Fees is numeric in your DB then pretty much everything after the =
Need way more info. What are you trying to do?
The setting of quotes seems completely wrong to me.
Assuming fees is numeric and you want to subtract the value in AdjyustAmount.Text then I'd say it should look like:
Code:SQL = "update TBL_TEST_LIB set FEES= & (fees - Val(AdjustAmount.Text) & ";"
Try the following way !
:wave:Code:dim SQL$
SQL = "update TBL_TEST_LIB set FEES=" & (fees - Val(AdjustAmount.Text)
CN.Execute SQL
It is possible guys that Fees is not a variable within the program but rather the intent may be to reduce the current value of Fees in the database by the value of the text in the text box. In which case the select would need to be a bit different than any posted thus far.
The op needs to provide info as to what he is actually trying to do.
if fees is either integer or Long Variable then the following code will work fine .let me know .really what you want ? .
:DCode:dim SQL$
SQL = "update TBL_TEST_LIB set FEES=" & (fees - Val(AdjustAmount.Text)
CN.Execute SQL
Oh. Seems I forgot a quote in my first answer.
Ok, if DataMisers assumption is right and we want to reduce a field named FEES by a value then it must be:
where the text field must contain a valid numerical.Code:SQL = "update TBL_TEST_LIB set FEES=FEES & " - " & AdjustAmount.Text
HI Wof,
it seems one more Inverted Comma is Needed .isn't it ?
:wave:Code:SQL = "update TBL_TEST_LIB set FEES=" FEES & " - " & AdjustAmount.Text
Oh... I forgot to delete the first & and following quote. :rolleyes:
Yes, firoz, it obviously is. But NOT in the place you are indicating.
My final vote is
FEES is a field name of the table. It is not known stand-alone outside the SQL string.Code:SQL = "update TBL_TEST_LIB set FEES=FEES - " & AdjustAmount.Text
The only thing outside the string which must be catenated with the & is the numeric value in the text field. Even the Minus sign must be within the string.
oh yes, wof is really genious .i even did not notice . fees is a fieldName in a table TBL_TEST_LIB .:D:DQuote:
The only thing outside the string which must be catenated with the & is the numeric value in the text field. Even the Minus sign must be within the string.
We could produce some more proposals while waiting for a reply of the OP. ;)