-
Get values from Access Query thru VB
I have a query called “QueryTot” which calculates the sum of fields and I am trying to store the values to variables thru the following code, but I am getting the values as null.
Dim Dbs As Database
Dim Tot As Recordset
Dim strSqlTot as string
strSqlTot = SELECT Sum(QueryTot.Bal1) AS SumOfBal1, Sum(QueryTot.Bal2) AS SumOfBal2, Sum(QueryTot.Bal3) AS SumOfBal3 FROM QueryTot;
Set Tot = Dbs.OpenRecordset(strSqlTot)
Value1 = MrTotal.Fields(SumOfBal1)
Value2 = MrTotal.Fields(SumOfBal2)
Value3 = MrTotal.Fields(SumOfBal3)
How do I get the sum to the variables Value1, Value2, Value3?
Thanks in advance,
Sinni.
-
What is "MrTotal"? I would think you'd want to do:
Value1 = Tot.Fields("SumOfBal1")
Value2 = Tot.Fields("SumOfBal2")
Value3 = Tot.Fields("SumOfBal3")
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
I am sorry I made a typo, I have the code as
Value1 = Tot.Fields("SumOfBal1")
Value2 = Tot.Fields("SumOfBal2")
Value3 = Tot.Fields("SumOfBal3")
but still I get the value as null
Similar Threads
-
By David Croft in forum Database
Replies: 0
Last Post: 08-13-2003, 12:45 PM
-
By Mike Mitchell in forum .NET
Replies: 60
Last Post: 09-13-2002, 05:41 PM
-
By Michelle in forum VB Classic
Replies: 8
Last Post: 04-19-2002, 05:01 PM
-
By Geo K in forum VB Classic
Replies: 1
Last Post: 04-02-2002, 07:32 AM
-
By Paul Shaddick paul.shaddick in forum VB Classic
Replies: 0
Last Post: 09-24-2000, 10:36 AM
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks