I am trying to build a function that refers to the table instead to the form. I think i should use the DLookup function, i do not know any other way.
However, i receive the error "Expected : end of statement"
Can i refer to a table at all in the function mentioned below and where might the error
be in this function ?
Public Function RemoveBefore()
Dim SqlRemoveFromOrders As String
SqlRemoveFromOrders = " DELETE DISTINCTROW orders.orderdate AS Expr1 " & _
" FROM orders " & _
" WHERE orders.orderdate < DLookUp("[CutDate]";"TblCutDate")"
CurrentDb.Execute SqlRemoveFromOrders
End Function
However, i receive the error "Expected : end of statement"
Can i refer to a table at all in the function mentioned below and where might the error
be in this function ?
Public Function RemoveBefore()
Dim SqlRemoveFromOrders As String
SqlRemoveFromOrders = " DELETE DISTINCTROW orders.orderdate AS Expr1 " & _
" FROM orders " & _
" WHERE orders.orderdate < DLookUp("[CutDate]";"TblCutDate")"
CurrentDb.Execute SqlRemoveFromOrders
End Function