Input box in VBA SQL

  • Thread starter Thread starter Snurre Sprett
  • Start date Start date
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
 
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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Back
Top