I strongly suggest that you redesign your calendar table. (And please note that a Table and a Layout may have exactly the same name, but they are not the same thing.)
I suggest that you have one record for each day rather than one record for each month. This will lead to a much more flexible design that will make it much easier to set this up as well as many other tasks you may need to do with this database.
Here's a very simple calendar demo file you may want to take a closer look at: https://www.dropbox.com/s/e8d03xvwe8vtz85/Calendar.fp7
Many thanks Phil for your reply and suggestion.
Unfortunately for the purpose of this Calendar style setup, I couldn't use the standard typical setup such as from your attached sample. My Calendar layout is mainly to be used as a visual color coded layout than the typical calendar we are all familiar with.
I started to go through the functions Help screen and was able to find a solution for what I wanted to do and it worked out perfectly.
I created a calculations field in my Calendar table to collect all records pertaining to the patient with a LIST function. I now have a listing of all unique visit date records from the Daily Visits table. Next I used a FilterValues formula along with IsEmpty for the Conditional Formatting for each of the box. The sample formula below:
IsEmpty(FilterValues ( Calendar Worksheet::DailyVisitListing; Self & Calendar Worksheet::FD14 & Calendar Worksheet::_fkPatientID & Calendar Worksheet::_fkCarePeriodID)) = 0
What I've basically done is have each box using a preset unique visit code to check and see if it is listed in Calculated Visits field. If it is found in the calculated field, highlight itself to the color I've preset it.
I've attached a picture of the calendar layout and a sample of the color scheme I was trying to create. Hopefully others will find this useful.
Note that color highlights you see there for the four boxes under the dates (Week 2 Friday and Week 2 Saturday) is just two sample color scheme I'm testing out. Single color vs multi-color scheme.
I see nothing here that cannot be adapted to the structure of the demo file. But keep in mind that a screen shot of a layout, taken in browse mode conveys very little information about the structure of your file and you haven't really laid out in this thread the other tables in your system and how they are related.
The "Day boxes" in my demo file are filtered portals, there's no reason why the portal's filter can't be used filter for a specific subset of records such as all the "visit" records for a specified client.