Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    1

    Unanswered: Count Automatically Scheduled Appointments by Current Date

    How can I display automatically a count of the appointments that are scheduled by the current date? I am doing the following, but it doesn't work: =Count([Date])=Date(), and I have also tried: =DCount("[Date]","Exampletestingschedule","[Date] =#" &CurrentDateTextbox26 & "#"). What am I doing wrong.

    Note: I using a textbox in a form to display the count for the current date.

  2. #2
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Hello,

    Providing your Access put a space in after the & symbol, so that the control source is:
    Code:
    =DCount("[Date]","Exampletestingschedule","[Date] =#" & CurrentDateTextbox26 & "#")
    it is correctly structured.

    I would suggest using a field name other than "Date" - perhaps fldDate or something similar. Also, put the control name in brackets: [CurrentDateTextbox26].

    Using this in a control will return #Error whenever there is not a valid date value in the text box, but will work correctly when there is a valid date.

    This all assumes that you have a table called Exampletestingschedule with a date field called Date.

    So, to get off the ground, rename your field and try this in the control source:
    Code:
    =DCount("[fldDate]","[Exampletestingschedule]","[fldDate] =#" & [CurrentDateTextbox26] & "#")
    An alternate method would be to use a "Totals Query" - group by the Date field and Count any field (such as the Date Field). This will accomplish the same thing, and then you can use a DLookup on the query to accomplish the task.

    Good luck.
    have fun!

    Todd S.
    click to email


    Independent Development Consultant
    Biz db & reports - SQL, Access, Crystal, Seradex and more
    Small, custom, unique programs - Office, VBA, .NET


    _________________________________________________
    Favorite message from Windows:
    There was an error displaying the previous error message

    Sadly, there was no error number to look up ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •