I'm missing something really simple but I don't see. When I run the code
below I am getting a data mismatch error on the last execute statements.
Function WorkListBuild()
'Route Variables
Dim b As Integer
b = 15
'This line Works
Set rs = cn.Execute("SELECT COUNT(lacct) From tblWorkLists WHERE
DaysPastDue = 15 ")
'This line does not,
Set rs = cn.Execute("SELECT COUNT(lacct) From tblWorkLists WHERE
DaysPastDue = b ")
End Function
Thanks for the help
Daniel Pineault - 27 Feb 2008 01:42 GMT
Try
Set rs = cn.Execute("SELECT COUNT(lacct) From tblWorkLists WHERE
DaysPastDue = " & b )

Signature
Hope this helps,
Daniel Pineault
http://www.cardaconsultants.com
If this post was helpful, please rate it by using the vote buttons.
> I'm missing something really simple but I don't see. When I run the code
> below I am getting a data mismatch error on the last execute statements.
[quoted text clipped - 15 lines]
>
> Thanks for the help
John W. Vinson - 27 Feb 2008 01:58 GMT
>I'm missing something really simple but I don't see. When I run the code
>below I am getting a data mismatch error on the last execute statements.
[quoted text clipped - 13 lines]
>
>End Function
You need to concatenate the *value* of the variable into the query, not its
name. The JET query engine doesn't know anything about VBA variables. Try
Set rs = cn.Execute("SELECT COUNT(lacct) From tblWorkLists WHERE
DaysPastDue = " & b )

Signature
John W. Vinson [MVP]