Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Error on button click

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 28 Nov 2006 19:44 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.