Assign Dlookup result to text box issues RTE 2471, HELP

F

FrankBooth

Hello,

I'd appreciate some help on this problem, thanks.

I want to assign the query's return value to a textbox and I'm using
DLookup. However I keep getting RTE 2471 saying that "The object
doesn't contain the automation object [Please Enter Start Date for Avg
Calc]."

Here is my Query:
SELECT [Please Enter Start Date for Avg Calc] AS AvgStart, [Please
Enter End Date for Avg Calc] AS AvgEnd, Avg(Login.StartTime) AS
AvgOfStartTime
FROM Login, Employees
WHERE (((Login.EmployeeID)<>12) AND ((Login.StartDate)>=[Please Enter
Start Date for Avg Calc]) AND ((Login.StartDate)<=[Please Enter End
Date for Avg Calc]));


Here is my code segment:

Private Sub Command13_Click()

Dim xDate As Variant

xDate = DLookup("[StartTime]", "DeptAverage")

End Sub

I tried assigning the WHERE clause of the query to the criteria, but
it still gives the same error. I also tried "[StartTime]<>'"& NULL
&"'" as the criteria and still got the same error.

Would someone please point me to what I might be missing or doing
wrong.

Thank you very much in advance,
--FB
 
Top