using an excel database function in Visual Basic

  • Thread starter Thread starter TAD from DBL
  • Start date Start date
T

TAD from DBL

How do I property invoke/use an excel database function like dsum in a visual
basic sub?

why can't I just set

x = dsum(tablerange,"fieldname",criterianame)

How do I declare this existing function? I am new to this.
 
Hi

Can you try the following

x = Application.WorksheetFunction.DSum(tablerange, "fieldname", criterianame)

Cheers
Shasur
 
Shasur, it gives me an "object required error"

Thanks for your input!

Dim QueryArray(2) As Integer
Dim x As Integer
x = Application.WorksheetFunction.DSum(testtable, "Secondfield",
firstcriteria)
QueryArray(0) = 100
QueryArray(1) = x
QueryArray(2) = 500
Range("J28") = QueryArray(0)
Range("J29") = QueryArray(1)
Range("J30") = QueryArray(3)
 
Back
Top