What Bruce showed above is correct. However why I asked all questions before giving you that answer is because the Format function returns a string while the Year, Month, and Day functions returns an integer. So you need to declare the variable of the correct type. If you want to handle the date parts as strings you can just as well use the following code instead of using the Year, Month, and Day functions.But for the above to work properly the Y, M, and D variables should be declared as strings.VB Code:
Y = Format$(theDate, "yy") M = Format$(theDate, "mm") D = Format$(theDate, "dd")




Reply With Quote