lundi 20 avril 2015

Excel VBA Aggregate Function Error

I am new to Excel VBA. When I run the below code, I get an error "missing operator in query expression sum[Project Hrs]". What am I doing wrong?

Sub TaskHrs()

   strSQL = "Select [User Name], [Task Name], sum[Project Hrs] from [idata$]      group by [User Name], [Task Name]"

   closeRS
   OpenDB

   rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic

  If rs.RecordCount > 0 Then
   Do While Not rs.EOF
     Range("A1").CopyFromRecordset rs
   Loop
  End If


End Sub

1 commentaire:

  1. Did you know that that you can generate cash by locking selected areas of your blog / website?
    Simply join AdscendMedia and use their Content Locking tool.

    RépondreSupprimer