Getting the results of a query into a variable 
Author Message
 Getting the results of a query into a variable

Could someone tell me why the following code doesn't work and how to
re-write it to make it work. I have 2 text boxes (txtUserName &
txtResult) and a command button(cmdCheckTime). I need to get the results

of the query into a variable so I can send it to another function.

Thanks,
Scott

Private Sub cmdCheckTime_Click()
    Dim db As DataBase
    Dim rs As RecordSet
    Set db = OpenDatabase("C:\Radius.mdb")
    Set rs = db.OpenRecordset("SELECT SUM(Time) AS TotalTime FROM Radius

" _ & "WHERE User = '" & txtUserName & "'" & "AND Date > 9/1/98")
    txtResult = rs.Fields.TotalTime
End Sub



Sat, 24 Mar 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Getting query results into an HTML table

2. Getting query results into an HTML table

3. Pbm getting result of an SQL query

4. Modules: setting a variable in memory to the results of a query (EXCEL AUTOMATION)

5. Placing Result of Query into Variable

6. Assigning the results of a query to a variable (cont)

7. Assigning the results of a query to a variable

8. Using a query result as a variable in code

9. how do I get an sql query to return result to a variable

10. Saving results of query into variables with multiple types

11. Negative variable ^ variable gives wrong result

12. using a query result to run another query

 

 
Powered by phpBB® Forum Software