Bonediggler
Technical User
Hi there,
I am trying to use a DLookup function to scan an existing table for a specified date value. If the value is found, the procedure will terminate with a message box. If the value is not found, the procedure will continue and import the specified Excel sheet.
The code I wrote to do the above keeps giving me a type-mismatch error:
Dim LookupMonth As Integer
Dim LookupDay As Integer
Dim LookupYear As Integer
Dim LookupFullDate As Date
LookupDay = Right(txtValues.Value, 2)
LookupYear = "2007"
NewValue = txtValues.Value & "!"
(code)
Select Case Left(txtValues.Value, 3)
Case "Sep"
LookupMonth = 9
End Select
LookupFullDate = CDate(LookupMonth & "/" & LookupDay & "/" & LookupYear)
BooleanValue = IsNull(DLookup("[Date]", "tbl_DNIS", "Date =#" & LookupFullDate & "#"))
If BooleanValue Is True Then
Resume ExecuteLine
Else
MsgBox ("You are about to reimport existing data")
Resume ExitLine
End If
(code)
Any help is greatly appreciated.
I am trying to use a DLookup function to scan an existing table for a specified date value. If the value is found, the procedure will terminate with a message box. If the value is not found, the procedure will continue and import the specified Excel sheet.
The code I wrote to do the above keeps giving me a type-mismatch error:
Dim LookupMonth As Integer
Dim LookupDay As Integer
Dim LookupYear As Integer
Dim LookupFullDate As Date
LookupDay = Right(txtValues.Value, 2)
LookupYear = "2007"
NewValue = txtValues.Value & "!"
(code)
Select Case Left(txtValues.Value, 3)
Case "Sep"
LookupMonth = 9
End Select
LookupFullDate = CDate(LookupMonth & "/" & LookupDay & "/" & LookupYear)
BooleanValue = IsNull(DLookup("[Date]", "tbl_DNIS", "Date =#" & LookupFullDate & "#"))
If BooleanValue Is True Then
Resume ExecuteLine
Else
MsgBox ("You are about to reimport existing data")
Resume ExitLine
End If
(code)
Any help is greatly appreciated.