Hi, Hope all is well. I was wondering if someone could help me out with a date formatting issue I have. I've been using a bit of code for date formatting and now that I'm trying to use it to find the previous date I think I'm doing something wrong.
The above code gives the correct date but I have to add +1 to the day and month to get the correct date even though if I use now() in a message box I get the correct date, why does it lose the correct value. Also if I format the month part with "mm" (which I now think is correct it loses a month ?
Could someone tell me please what the correct format should be for todays date..and if this could be used to find the previous days date?
thanks for reading
Code:
Dim DT3 As String
DoCmd.SetWarnings False
MsgBox (Now())
DT3 = (Format(Day(Now()) + 1, "dd") & "D" & Format(Month(Now()) + 1, "dd") & Format(Now(), "yy"))
MsgBox ("DT3 " & DT3)
The above code gives the correct date but I have to add +1 to the day and month to get the correct date even though if I use now() in a message box I get the correct date, why does it lose the correct value. Also if I format the month part with "mm" (which I now think is correct it loses a month ?
Could someone tell me please what the correct format should be for todays date..and if this could be used to find the previous days date?
thanks for reading