i have a form, that has a button. when the button is clicked, a sql
statement is formed. the onlly part of the sql statement that changes is a
where clause.
i have a date field on the form (medium date format) this is used to
compare to the tblMain.Date field (also medium date)
however, i get error 13: Type mismatch whenever i try to use it.
"WHERE (((tblMain.Date)>=#" + [StartDate] + "#));"
but if i replace the " + [StartDate] + " with say, 1/1/2000 i.e. "WHERE
(((tblMain.Date)>=#1/1/2000#));" i get the query result.
am i missing something?
Kc-Mass - 28 Nov 2006 20:36 GMT
Substitute an ampersand (&) for each plus sign (+)
Kevin C
>i have a form, that has a button. when the button is clicked, a sql
> statement is formed. the onlly part of the sql statement that changes is
[quoted text clipped - 12 lines]
>
> am i missing something?
Mike - 28 Nov 2006 20:44 GMT
why an ampersand instead of a plus?
> Substitute an ampersand (&) for each plus sign (+)
>
[quoted text clipped - 16 lines]
> >
> > am i missing something?
Keith Wilby - 29 Nov 2006 13:14 GMT
> why an ampersand instead of a plus?
Because that's the correct syntax. "+" is a mathematical operation whilst
"&" concatenates elements of a string or expression.
Keith.
www.keithwilby.com
John Spencer - 29 Nov 2006 12:40 GMT
Try
WHERE tblMain.Date >=#" & CDate([StartDate]) & "#"
>i have a form, that has a button. when the button is clicked, a sql
> statement is formed. the onlly part of the sql statement that changes is
[quoted text clipped - 12 lines]
>
> am i missing something?