I am trying to insert records to a table from another using sql in access through vba. everything works but I want a field that contains a date to be greater than the first of the year that the user inputs. When I added that command into my statement no records are inserted and I'm pretty sure it is because I am not comparing the date right. I am rather new to sql so any help on this issue and how to fix it would be greatly appreciated! I have posted the statement below.
verifHPMS = "INSERT INTO HPMSVerified([CLIENT ID], [CLIENT NAME], [MARKET SEGMENT], [FORMULARY ID], [FORMULARY NAME], [FORMULARY VERSION],[HPMS EXPORTED],[HPMS EXPORT DATE],[APPROVED DATE]) " & _
"SELECT DD.[CLIENT ID],DD.[CLIENT NAME],DD.[MARKET SEGMENT],DD.[FORMULARY ID],DD.[FORMULARY NAME],DD.[FORMULARY VERSION],DD.[HPMS EXPORTED],DD.[HPMS EXPORT DATE],DD.[APPROVED DATE] " & _
"FROM " & tableName & " as DD " & _
"Where DD.[HPMS EXPORTED] IN (""Yes"") " & _
"AND DD.[HPMS EXPORT DATE] >= [APPROVED DATE] " & _
"AND DD.[CLIENT ID] NOT IN(SELECT Exclusions.[Client ID] FROM Exclusions)" & _
"AND DD.[APPROVED DATE]>01/01/" & year