The following code gave me this error: "Run-time error '2471': The expression you have entered as a query parameter produced this error:'dStartDate'"
Dim cStartAmount As Currency
Dim dDocumentDate As Date
Dim dStartDate As Date
Dim dEndDate As Date
dStartDate = Me.txt_startdate '01-Mar-17
dEndDate = Me.txt_enddate '01-Mar-50
dDocumentDate = DLookup("[DocumentDate10]", "t03SalSumMnth", "t03salsummnth.SlSmMnID=" & 1)
cStartAmount = DLookup("[StartAmount]", "t02PAYE", "#" & Format([dDocumentDate], "yyyy-mm-dd") & "# Between dStartDate And dEndDate")
What I'm trying to accomplish is to find "[StartAmount]" fields value where dDocumentDate is bigger than dStartDate and smaller than dEndDate