Input box in VBA SQL

S

Snurre Sprett

Hi.

The query works fine, but a want it in VBA..

I want the user to input a year in a input box when
running VBA, but it will not accept the code (below)
copied from the SQL option in the datasheet view. VBA
errors on the first "yyyy".

SELECT Ansatte.*, Prosjekter.*, DatePart("yyyy",[Enddate])
AS Endyear FROM Ansatte INNER JOIN Prosjekter ON
Ansatte.AnsattID = Prosjekter.AnsattID
WHERE (((DatePart("yyyy",[Enddate]))=[End year]))
ORDER BY DatePart("yyyy",[Enddate]) DESC;

Can anyone help me, please ?

Regards
Snurre
 
M

[MVP] S. Clark

How are you utilizing this in VBA? You have posted the SQL, but how are you
translating that into VBA and executing the query?

Post your full procedure, and any error messages that you are receiving.


--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top