Microsoft
Software
Hardware
Network
Question : Quotation marks and # signs around variable dates and date parts
intYearLoop is the year in integer in a range of years
strYear is the same value in a string
dteStartDate = ("#1 / 1 / " & intYearLoop & "#") and any of about 10 other ways I have tried this all give me an error 13, data type mismatch.
I need to have the rst contain all values in a given year, which changes with the for/next loop.
This is used in a for/next loop from 2006 to whatever year it is currently. (Yes, it is now 2010.)
dtestartdate is set as a date datatype. It works everywhere else.
What is wrong here and/or does anyone have the total truth or documentation on these pesky dates!
Susan
Answer : Quotation marks and # signs around variable dates and date parts
use this
dteStartDate = DateSerial(intYearLoop, 1, 1)
Random Solutions
Visual Basic Code - Excel - Merge multiple worksheets in an excel workbook into single worksheet
Autofill Date Field in Access 2007
MOSS 2007 using EXPRESS version of MS SQL instead of MS SQL 2005 STANDARD
The report server is not responding. Verify that the report server is running and can be accessed from this computer.
search method in VBA Access
Arrays in Excel macro
When establishing an ADO connection to a database, is it necessary to have a file path that is free of blank spaces?
how to store emails from exchange server into a tale in access?
Outlook XP won't install MAPI services
Error message saying cannot connect to linked SQL Server