Hi,
In Excel I am getting data from an access database, and I want to sum the data in one field, entitled "mult". I must be doing something idiotically wrong here, could someone point me in the right direction? Here's what I have -
Can anyone assist?
In Excel I am getting data from an access database, and I want to sum the data in one field, entitled "mult". I must be doing something idiotically wrong here, could someone point me in the right direction? Here's what I have -
Code:
Dim sql_st As String
cnt = 35
Do Until ActiveSheet.Range("ab" & cnt).Value = ""
cname = ActiveSheet.Range("ad" & cnt).Value
mdate = ActiveSheet.Range("ab2").Value
Set wrkjet = CreateWorkspace("", "admin", "", dbUseJet)
Set dbsfile = wrkjet.OpenDatabase("c:\mydatabase.mdb")
sql_st = "Select * FROM data Where client = '" & cname & _
"' AND Date < #" & Format(mdate, "mm/d/yyyy") & "#;"
Set rstmeet = dbsfile.OpenRecordset(sql_st, dbOpenDynaset)
If rstmeet.RecordCount > 0 Then
rstmeet.MoveFirst
With rstmeet
ActiveSheet.Range("bw" & cnt + 5).Value = rstmeet.RecordCount
ActiveSheet.Range("bx" & cnt + 5).Value = Sum(!mult)
End With
Can anyone assist?