-
March 7th, 2012, 09:18 PM
#1
Big Problem
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
-
March 7th, 2012, 10:51 PM
#2
Re: Big Problem
Assuming Fees is numeric in your DB then pretty much everything after the =
Always use [code][/code] tags when posting code.
-
March 8th, 2012, 01:28 AM
#3
Re: Big Problem
Need way more info. What are you trying to do?
-
March 8th, 2012, 06:57 AM
#4
Re: Big Problem
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) & ";"
-
March 8th, 2012, 01:33 PM
#5
Re: Big Problem
Try the following way !
Code:
dim SQL$
SQL = "update TBL_TEST_LIB set FEES=" & (fees - Val(AdjustAmount.Text)
CN.Execute SQL
Last edited by firoz.raj; March 8th, 2012 at 01:36 PM.
-
March 8th, 2012, 02:40 PM
#6
Re: Big Problem
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.
Always use [code][/code] tags when posting code.
-
March 8th, 2012, 03:19 PM
#7
Re: Big Problem
if fees is either integer or Long Variable then the following code will work fine .let me know .really what you want ? .
Code:
dim SQL$
SQL = "update TBL_TEST_LIB set FEES=" & (fees - Val(AdjustAmount.Text)
CN.Execute SQL
-
March 9th, 2012, 07:02 AM
#8
Re: Big Problem
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:
Code:
SQL = "update TBL_TEST_LIB set FEES=FEES & " - " & AdjustAmount.Text
where the text field must contain a valid numerical.
-
March 9th, 2012, 08:45 AM
#9
Re: Big Problem
HI Wof,
it seems one more Inverted Comma is Needed .isn't it ?
Code:
SQL = "update TBL_TEST_LIB set FEES=" FEES & " - " & AdjustAmount.Text
-
March 9th, 2012, 09:23 AM
#10
Re: Big Problem
Oh... I forgot to delete the first & and following quote.
Yes, firoz, it obviously is. But NOT in the place you are indicating.
My final vote is
Code:
SQL = "update TBL_TEST_LIB set FEES=FEES - " & AdjustAmount.Text
FEES is a field name of the table. It is not known stand-alone outside the SQL string.
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.
-
March 9th, 2012, 10:18 AM
#11
Re: Big Problem
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 .
-
March 9th, 2012, 12:40 PM
#12
Re: Big Problem
Originally Posted by firoz.raj
oh yes, wof is really genious .i even did not notice . fees is a fieldName in a table TBL_TEST_LIB .
That is what I was talking about in Post #6
The code posted by WOF is probably what he needs but since the OP did not explain what he was trying to do it is not possible to be sure.
Always use [code][/code] tags when posting code.
-
March 11th, 2012, 02:09 PM
#13
Re: Big Problem
We could produce some more proposals while waiting for a reply of the OP.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|