S
Song Su
I have a query code and tested ok.
SELECT Count(dbo_tblVisits.id) AS CountOfid
FROM dbo_tblVisits
WHERE (((dbo_tblVisits.timeIn)>=[forms]![mainmenu].[cbofrom]) AND
((dbo_tblVisits.timeOut)<=[forms]![mainmenu].[cboto]+1));
But when I put that query as a controlsource of a form control, I got #Name?
Private Sub Form_Load()
Dim strRecordCount As String
strRecordCount = "SELECT Count(dbo_tblVisits.id) AS CountOfid" & _
"From dbo_tblVisits WHERE
(((dbo_tblVisits.timeIn)>=[forms]![mainmenu].[cbofrom])" & _
" AND ((dbo_tblVisits.timeOut)<=[forms]![mainmenu].[cboto]+1))"
Me.TotalHour.ControlSource = strRecordCount
End Sub
Where did I do wrong?
SELECT Count(dbo_tblVisits.id) AS CountOfid
FROM dbo_tblVisits
WHERE (((dbo_tblVisits.timeIn)>=[forms]![mainmenu].[cbofrom]) AND
((dbo_tblVisits.timeOut)<=[forms]![mainmenu].[cboto]+1));
But when I put that query as a controlsource of a form control, I got #Name?
Private Sub Form_Load()
Dim strRecordCount As String
strRecordCount = "SELECT Count(dbo_tblVisits.id) AS CountOfid" & _
"From dbo_tblVisits WHERE
(((dbo_tblVisits.timeIn)>=[forms]![mainmenu].[cbofrom])" & _
" AND ((dbo_tblVisits.timeOut)<=[forms]![mainmenu].[cboto]+1))"
Me.TotalHour.ControlSource = strRecordCount
End Sub
Where did I do wrong?