sql value in a text box

  • Thread starter Thread starter JKlein
  • Start date Start date
J

JKlein

I am trying to use this sql to return the number of records in a query and
show it in a text box.
It shows the text not the value! Any help would be appreciated.

Text23.Value = "SELECT Count(tbl_TempCalendarData.MeetingID) AS
CountOfMeetingID FROM tbl_TempCalendarData GROUP BY
tbl_TempCalendarData.meetingdate HAVING
(((tbl_TempCalendarData.meetingdate)=#5/28/2006#))"
 
Text23.Value = DCount("MeetingID", "tbl_TempCalendarData",
"meetingdate=#5/28/2006#")

Incidentally, there was no need for the GROUP BY in your original SQL. You
only need GROUP BY when the field is included in the SELECT part of the SQL:

SELECT Count(MeetingID) AS CountOfMeetingID
FROM tbl_TempCalendarData
WHERE meetingdate=#5/28/2006#"

(not that you can use SQL in the way you were trying)
 
Douglas....thanks for the reply. This works great except when there are no
records to show. I need a way of returning a "0" if this is the case. I
have tried various ways but cant figure it out.
 
That's odd. DCount returns 0 for me when there are no records that match,
even when there's no data in the table.
 
Back
Top