I have a form where the user inputs two days, the start and end dates for vacation time. These text boxes are formatted for short date, and the date picker was used for this test (though I want it to work when manually entered as well)
I am trying to put these dates into the Vacation_Time table, but they come in as shown in the picture below (12/30/1899 and they show a timestamp if i target the value in the table) even though they are data type DATE across the board.
The messagebox popup (see picture attachment below) shows what is calculated for each value. Maybe it's because I have it formatted as a short date?
I suppose I could just store them as text, since the only thing I would use them for is to calculate days of vacation which is already working as intended.
I must be missing something, here is my code:
Code:
Dim Employee_ID_Temp As IntegerDim Employee_Name As String
Dim Vacation_Start As Date
Dim Vacation_End As Date
Dim Vacation_Days_Calculated As Integer
Employee_Name = Me.txtVacation_Employee.Value
Employee_ID_Temp = Me.txtVacation_Employee_ID.Value
Vacation_Start = Me.txtVacation_Start.Value
Vacation_End = Me.txtVacation_End.Value
Vacation_Days_Calculated = WorkdayDiff(Vacation_Start, Vacation_End)
MsgBox ("Vacation Days Used: " & Vacation_Days_Calculated & " Start Date: " & Vacation_Start & " End Date: " & Vacation_End)
strSQL = "INSERT INTO Vacation_Time ( Employee_ID, Start_Date, End_Date, Vacation_Days_Used ) VALUES (" & Employee_ID_Temp & ", " & Vacation_Start & ", " & Vacation_End & ", " & Vacation_Days_Calculated & ");"
DoCmd.RunSQL (strSQL)