In MS Access 2010, I use a table having three fields:
- ID(Auto Number)
- BatchEndDate(Text)
- IsImported(Yes/No).
I am using the following VBA Code to read a value from field 3 with reference to field 2. This code works well but when I change the data type of field 2 from Text to Date/Time, it doesn't work and an error message is displayed showing
Data type mismatch in criteria expression
Please suggest me the changes in code to resolve the issue.
Dim selectedBatchDate As Variant
selectedBatchDate = Me.cmboBatchDate
Dim importCheck As Variant
importCheck = DLookup("[Is Imported]", "BatchEndDate", "[Batch End Date] = '" & selectedBatchDate & "'")
MsgBox ("Import Status is " & importCheck), vbInformation, "Import Status"