Dear all,
I am trying to retreive data from an Access table, depending on the dates chosen by the user. I have 2 list boxes, NewsMonth and NewsYear, and the results are numbers, for example for NewsMonth, June is 6 and for the year it is 2003. Then I am trying to create the sql to retrieve the correct data but I am getting a syntax error. Can you please help?
THis is my sql:-
'*** Create the sql to retreive the main sections from the table
sqlNews = "SELECT * FROM newsArticles "
sqlNews=sqlNews & " WHERE (month(newsDate)) = #" & NewsMonth & "#"
sqlNews=sqlNews & " AND (Year(newsDate)) = #" & NewsYear & "#"
sqlNews=sqlNews & " ORDER BY NewsDate Desc"
Thanks for your help and time
I am trying to retreive data from an Access table, depending on the dates chosen by the user. I have 2 list boxes, NewsMonth and NewsYear, and the results are numbers, for example for NewsMonth, June is 6 and for the year it is 2003. Then I am trying to create the sql to retrieve the correct data but I am getting a syntax error. Can you please help?
THis is my sql:-
'*** Create the sql to retreive the main sections from the table
sqlNews = "SELECT * FROM newsArticles "
sqlNews=sqlNews & " WHERE (month(newsDate)) = #" & NewsMonth & "#"
sqlNews=sqlNews & " AND (Year(newsDate)) = #" & NewsYear & "#"
sqlNews=sqlNews & " ORDER BY NewsDate Desc"
Thanks for your help and time