Kamis, 22 Oktober 2015

[MS_AccessPros] VBA with SQL code error question

 

Hello all,


I have code that is to email the users from a sql code. For some reason the code works If I leave off the form reference as the Between criteria in the query the sql statement.


Here is the sql statement in the vba

strSQL = "SELECT DISTINCT Events.ContactName, Events.Email From Events GROUP BY Events.ContactName, Events.Email, Events.PickupDt HAVING (((Events.PickupDt) Between [Enter start date] And [Enter End date]));"


I get an error message which states

Run-time error 3061

Too few parameters. Expected 2.


If I take out the having part it works with this below.

strSQL = "qryEventDistributionEmailList"


this query has the criteria typed as Between #10/1/2015# And #10/11/2015# and it works.

How do I reference in the sql statement in vba to look at the form text boxes.


Thank You

Jim Wagner

__._,_.___

Posted by: luvmymelody@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar