views:

61

answers:

2

i am connecting to mysql using adodb from excel

i am doing:

dpath = Range("B2").Text
atime = Trim(Range("B3").Text)
rtime = Trim(Range("B4").Text)
lcalib = Trim(Range("B5").Text)
aname = Trim(Range("B6").Text)
rname = Trim(Range("B7").Text)
bstate = Trim(Range("B8").Text)


rs.Filter "datapath=dpath and analystname=aname and reportname=rname and batchstate"

but it's giving me an error that it is invalid use of filter property

what is the correct way to use the filter property?

+1  A: 

Filter is a property, not a method, so you have to assign to it, not call it. Basically you're missing an equals sign: it should be rs.Filter = ...

Dan
+1  A: 

Filter is a property, plus you're using external variables in your string. The filter will have no knowledge of them. You need something like:

rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "' and batchstate='" + batchstate + "'"
mjmarsh