PDA

View Full Version : [SOLVED:] trying to find number of days in a table between two dates



sdhruv
06-04-2015, 10:45 PM
I am trying to find the number of holidays in a table called tblholidays primary key field is HolidayDate and the dates are Start Date and Text8. I used the following code but it gives the error Compile error: Invalid character.


code:

Dcount("*", "tblHolidays", _ "HolidayDate Between " & _ Format$(StartDate, "\#dd\/mm\/yyyy\#") & _ "And" & _ Format$(Text8, "\#dd\/mm\/yyyy\#"))

jonh
06-04-2015, 11:43 PM
It's always a good idea to put complex strings into a variable so you can debug.print them.

I would guess your "And" should have spaces arround it.

sdhruv
06-05-2015, 01:56 AM
I got it, it was a simple matter of taking out the underscores