I am stumped on something that should be very simple...
I have a form with a calendar control. As a new date is selected in the calendar control, I am storing the value in a temporary table so that I can allow the user to select multiple values. The TEMP table field is a Date data type.
Before a new value is inserted, I'm first performing a check to be sure that the value wasn't already selected. BUT, I continue to get a Type Mismatch error.
I've tried MANY different ways, but none have worked and I am completely stumped.
Column: TrainingDate (Date/Time datatype)
Form Calendar Control Name: TrainingCal
See VBA code below, the error occurs in the recordset string.
See notes at the bottom of the VBA code for other variations I have tried.
Dim strValDates As Recordset
Set strValDates = CurrentDb.OpenRecordset("SELECT TrainingDate FROM
tbl_TEMP_TrainingDates WHERE TrainingDate = '" & _
Me.TrainingCal & "'")
''ve tried the above code a dozen different ways
'--Surrounding the Me.TrainingCal with single quotes, "#" signs, both single quotes And "#" signs
'--Creating a Date variable and then assigned the TrainingCal value to this variable and then using that variable within the recordset.
'--Created a String variable and set it to the TrainingCal value
'--Tried using the CDate function to force the value to be a date