I dont completely understand what you are saying...assign a value? Do you mean you want to run the sql statement, and then find the first result? or the only result and then assign it to that variable?
Originally posted by bguymon
What I am trying to do is add(sum) time for a given day stored in several records with the same date, and display it on a form.
So 12/12/03 would return 5
Dim n as int
n = DoCmd.RunSql ("SELECT Sum(ProblemTickets.TimeSpent) AS Expr1
will not work.
Try something like that
Dim ff As String
Dim num As Long
ff = "SELECT SUM(ProblemTickets.TimeSpent) AS [Sum of Problems] INTO urTemp FROM ProblemTickets WHERE (((ProblemTickets.When)=#12/29/2003#));"
Now the sum will be stored in the first Record in the TableurTemp