The string seems to be ok at first glance (you are using the # for comparing
a date), but I did notice the existance of the semicolon in your VBA version,
which I believe should be omitted.
So instead of
> strSQL = "Select * From Needs " & _
> "WHERE (((Needs.client_id)= " & dblClient_ID & ") And
> ((Needs.due_date)= #" & dtCalc_Date & "#)) ;"
try
strSQL = "Select * From Needs " & _
"WHERE (((Needs.client_id)= " & dblClient_ID & ") And
((Needs.due_date)= #" & dtCalc_Date & "#))"
I'm not sure if that's the issue or not, but I thought I'd point it out.
--
Jack Leach
www.tristatemachine.com
- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain
"BobC" wrote:
> I have a query that I need to pull the needs for a client for a specific date:
>
> strSQL = "Select * From Needs " & _
> "WHERE (((Needs.client_id)= " & dblClient_ID & ") And
> ((Needs.due_date)= #" & dtCalc_Date & "#)) ;"
>
> The query is pulling all records for the client and seemingly ignoring the
> date parameter. The date is in mm/dd/yyyy format.
>
> This is what is visible in the object viewer for strSQL:
> Select * From Needs WHERE (((Needs.client_id)= 2) And ((Needs.due_date)=
> #2/1/2009#));
>
>
> --
> BobC
>