943,923 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jul 21st, 2009
0

sql commad problem

Expand Post »
In a data environment I write code like:
select ([exam fee]*[other fee]) as total from table1
then it work, but when I write like below it not work:
select sum[exam fee] as total from table1
what problem with it?
Similar Threads
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Jul 21st, 2009
0

Re: sql commad problem

How does it not work?

and should that not be ([exam fee] + [other fee])



Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jul 22nd, 2009
0

Re: sql commad problem

another thing. I write like:
"select sum[exam fee] as total , sum[other fee] as total_fee from table1"
it not work
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Jul 22nd, 2009
0

Re: sql commad problem

Are the fields numeric? If not that could be your problem but without seeing your code who knows.


Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Jul 23rd, 2009
0

Re: sql commad problem

ya that field are numeric.
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Jul 23rd, 2009
0

Re: sql commad problem

NOTE:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. sum[exam fee] ==> sum([exam fee])
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
Mbt925 is offline Offline
63 posts
since Dec 2007
Jul 23rd, 2009
0

Re: sql commad problem

Click to Expand / Collapse  Quote originally posted by Mbt925 ...
NOTE:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. sum[exam fee] ==> sum([exam fee])
I don't understand by this code. I want sum[exam fee] and sum[other fee]. is it possible with your code?
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Jul 23rd, 2009
0

Re: sql commad problem

Click to Expand / Collapse  Quote originally posted by abu taher ...
I don't understand by this code. I want sum[exam fee] and sum[other fee]. is it possible with your code?
yes.
SUM is a sql function. you must use '(' & ')' for it.

change your code in this way:
"select sum([exam fee]) as total , sum([other fee]) as total_fee from table1"
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
Mbt925 is offline Offline
63 posts
since Dec 2007
Jul 23rd, 2009
0

Re: sql commad problem

thanks Mtb 925. it works well. another thing when I input exam fee in a form and when I see the report it not update. I mean exam fee is 200 and I add again 200. so report will show 400/ but it show 200, when I exit and again open the project then show 400. please help me
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Jul 23rd, 2009
0

Re: sql commad problem

Click to Expand / Collapse  Quote originally posted by abu taher ...
thanks Mtb 925. it works well. another thing when I input exam fee in a form and when I see the report it not update. I mean exam fee is 200 and I add again 200. so report will show 400/ but it show 200, when I exit and again open the project then show 400. please help me
Your welcome.

you must reconnect it. attach your sample. i will edit it.
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
Mbt925 is offline Offline
63 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: How to create activation key for VB Application
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: date show in datareport





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC