mato01
asked on
Data Type Mismatch
Getting runtime error on the line below. Have references set to Microsoft DAO 3.6 Objects Library.
CurrentDb.Execute sql2
sql2 = "SELECT [tbl_GMNA Constraint Report Output].* FROM [tbl_GMNA Constraint Report Output]"
sql2 = sql2 & " WHERE [Constraint Number]='" & rst.Fields("Constraint Number")
sql2 = sql2 & "' ORDER BY [tbl_GMNA Constraint Report Output].[Constraint Number] DESC"
Set rst2 = CurrentDb.OpenRecordset(sql2, dbOpenDynaset)
datMax = rst2.Fields("Date Added")
If rst2.RecordCount > 1 Then
sql2 = "Delete * From [tbl_GMNA Constraint Report Output] WHERE [Constraint Number]=" & rst("Constraint Number")
sql2 = sql2 & " AND [Date Added] <> #" & datMax & "#"
CurrentDb.Execute sql2
End If
rst2.Close
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To help you troubleshoot, put a MsgBox(sql) before the problem row. That way you can see what the SQL is before the execution.
Try this:
Dim rst2 As DAO.Recordset