VBA sum data in rstmeet

Duritz

Board Regular
Joined
Apr 28, 2005
Messages
226
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 -

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?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,509
Messages
6,125,219
Members
449,215
Latest member
texmansru47

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top