SELECT with month and year

User avatar
sal21
PlatinumLounger
Posts: 4368
Joined: 26 Apr 2010, 17:36

SELECT with month and year

Post by sal21 »

MESE="12/2016"

this is a part of my sql:

...AND FORMAT(PRE.DATA_OP,'MM/YYYY')='" & MESE & "'" &...

is this the correct way, or ?

note:
MESE As string
i'm in VB6, Ado Jet and Access database
Last edited by sal21 on 23 Dec 2016, 20:31, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78588
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: SELECT with month and year

Post by HansV »

That should work, assuming that MESE always has 2 digits for the month (for example, for August: "08/2016").
Best wishes,
Hans