runtime error 3306 subquery prob

funkkube
funkkube used Ask the Experts™
on
hi

want this as a recordsource for a report..
keeps telling me runtime error 3306..
subquery problem..
why?
    tempsql = "SELECT [Visit Answers].* FROM [Visit Answers]WHERE ((([Visit Answers].DateOfVisit)=#1/24/2005#) AND (([Visit Answers].CustomerID)=9203));"

thanks

mat
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
try this

place a space before where

tempsql = "SELECT [Visit Answers].* FROM [Visit Answers] WHERE ((([Visit Answers].DateOfVisit)=#1/24/2005#) AND (([Visit Answers].CustomerID)=9203));"
Jim HornSQL Server Data Dude
Most Valuable Expert 2013
Author of the Year 2015

Commented:
capricorn1 is correct.

As an aside, I recommend naming your tables without spaces [Visit Answers], as having spaces in them necessitates the use of square brackets [ ], which is another thing to potentially forget/cause an error.

-Jim
Top Expert 2016
Commented:
just wondering why the error is runtime, normally you will get a syntax error with this.

there could be more than this space error.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial