Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - SQL Statement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SQL Statement

 Post Reply Post Reply
Author
padoxky View Drop Down
Groupie
Groupie
Avatar

Joined: 17 June 2004
Location: Nigeria
Status: Offline
Points: 78
Post Options Post Options   Thanks (0) Thanks(0)   Quote padoxky Quote  Post ReplyReply Direct Link To This Post Topic: SQL Statement
    Posted: 23 September 2005 at 9:19am
Well, i don't know hw to explain it but,
I did something like this
 
sql = "select 50 + amount_paid From tbl1 where id=" & userID
 
Where 50 is a fixed amount and amount_paid is a tbl field in dbase
 
So, whenever you want to view user's records it will addup the amount
Asuming, if the user enter $100 in the form. When selecting to  view the sql we run to add 50 + 100 which will displayed  $150
 
But is not working. Please help me out.
NgWebDesigns
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 26 September 2005 at 1:09pm

This will depend on the data type you have amount_paid in. Don't use money or so. If amount_payed is numeric, float or so, it should work fine. Also, they way you do it will no generate the right column name do something like

Select 50 + amount_paid as adjusted_paid from tbl1......
and then select it with rs("adjusted_paid")
Back to Top
padoxky View Drop Down
Groupie
Groupie
Avatar

Joined: 17 June 2004
Location: Nigeria
Status: Offline
Points: 78
Post Options Post Options   Thanks (0) Thanks(0)   Quote padoxky Quote  Post ReplyReply Direct Link To This Post Posted: 27 September 2005 at 1:00pm

the data type is text

Note am using access database
but let me try this.
NgWebDesigns
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 27 September 2005 at 1:10pm
Why are you storing an Integer in a text field? Use a Number field instead

Back to Top
padoxky View Drop Down
Groupie
Groupie
Avatar

Joined: 17 June 2004
Location: Nigeria
Status: Offline
Points: 78
Post Options Post Options   Thanks (0) Thanks(0)   Quote padoxky Quote  Post ReplyReply Direct Link To This Post Posted: 27 September 2005 at 1:37pm
Let me try that also
thanks


Edited by padoxky - 27 September 2005 at 1:44pm
NgWebDesigns
Back to Top
padoxky View Drop Down
Groupie
Groupie
Avatar

Joined: 17 June 2004
Location: Nigeria
Status: Offline
Points: 78
Post Options Post Options   Thanks (0) Thanks(0)   Quote padoxky Quote  Post ReplyReply Direct Link To This Post Posted: 28 September 2005 at 6:39am
Still not working.
NgWebDesigns
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 28 September 2005 at 6:58am
How about:

SELECT (SELECT amount_paid FROM tbl1) + 50 As adjusted_paid

Or if that doesn't work just use

SELECT amount_paid FROM tbl1

then when you loop through records use:

Dim adjusted_paid
adjusted_paid = CInt(rs("amount_paid")) + 50
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 28 September 2005 at 6:52pm
Originally posted by padoxky padoxky wrote:

Still not working.
 
More details please and if you have to paste the whole structure here, what we posted DOES work if you do it right but we cannot help with that little detail....
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.