473,395 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Add two dates (not ranges) to the Wide Calendar with Switchboard

Good afternoon and thank you to all the contributors of this site. I am very new and this site is a tremendous help and resource.

I am trying to add another Date field to the Wide Calendar with Switchboard database without success. Unfortunately, after a week of trying, I am still at the same place I started.

For each entry,I would like to have a Date and a FollowUpDate.

Any help would be greatly appreciated!
Attached Files
File Type: zip Wide Calendar with Switchboard.zip (139.7 KB, 114 views)
Oct 7 '13 #1
7 1627
ADezii
8,834 Expert 8TB
This can be rather complicated depending on exactly how you want the Follow Up Date to be displayed.
  1. Do you want both the Date and Follow Up Dates to be graphically displayed on the Calendar?
  2. Do you want the Date to be displayed on the Calendar and the Follow Up Date displayed in the List Box?
  3. etc...
  4. Before we can proceed any further, I need to know exactly what you are looking for. If you are not crystal clear on this matter, time will be wasted on both ends.
  5. Let me know your intent, and I'll se what I can do.
Oct 8 '13 #2
Thank you for your quick response! I want both the date and follow up date to be graphically displayed on the Calendar. Both dates will be coming from the same row on the tblPatients table (Date and Date2).

I am not really concerned about the List Box.

Every entry will always have two dates (Date and Date2) usually two weeks apart.

I keep messing around with the code but just can't get it figured out. Very complicated.
Oct 8 '13 #3
ADezii
8,834 Expert 8TB
@mmmendoz
The Access Calendar was designed to display either a Single Date or all Dates within a Date Range, but not two independent Dates. Let me get my thinking cap on and see if I can modify the Code to suit your needs. Be patient and I'll get back to you.
Oct 8 '13 #4
Thank you. I am still tinkering with the code. I have not figured it out by I am learning a lot in the process.
Oct 8 '13 #5
ADezii
8,834 Expert 8TB
  1. Given the fact that you are not concerned with the List Box, I disabled all Code and References to it.
  2. Change the name of the [Date] Field in tblPatients to [Date1] in order to avoid any conflicts with the Date() Function.
  3. Add a [Date2] {DATE/TIME} Field to tblPatients.
  4. Create the following Table Validation Rule to insure that [Date2] is always greater than [Date1]
    Expand|Select|Wrap|Line Numbers
    1. [Date2] > [Date1]
  5. Both [Date1] and [Date2] must be 'Required'.
  6. Replace all References to the [Date] Field in the PopulateCalendar() Sub-Routine to [Date1].
  7. Add the [Date2] to strSQL in the PopulateCalendar() Sub-Routine and include additional Logic to incorporate it (Code Lines 2 and 4).
    Expand|Select|Wrap|Line Numbers
    1. strSQL = "SELECT tblPatients.Last, tblPatients.First, tblPatients.Date1, tblVisitType.Type, tblVisitType.Code, tblPatients.Time, " & _
    2.          "tblPatients.[Date2] FROM tblVisitType INNER JOIN tblPatients ON tblVisitType.TypeID = tblPatients.TypeID " & _
    3.          "WHERE tblPatients.Date1 Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
    4.          " OR tblPatients.Date2 Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
    5.          " ORDER BY tblPatients.Time, tblPatients.Last, tblPatients.First;"
  8. Change the End Date qualifier in PopulateCalendar() to [Date2] (Code Line 7).
    Expand|Select|Wrap|Line Numbers
    1. Do While Not rstEvents.EOF
    2.   'CFB added 2-18-10
    3.   lngFirstDateInRange = rstEvents![Date1]      '<Substitute for [Start Date]>
    4.   If lngFirstDateInRange < lngFirstOfMonth Then
    5.     lngFirstDateInRange = lngFirstOfMonth
    6.   End If
    7.   lngLastDateInRange = rstEvents![Date2]         '<Substitute for [End Date]>
    8.   If lngLastDateInRange > lngLastOfMonth Then
    9.     lngLastDateInRange = lngLastOfMonth
    10.   End If
    11.  
    12.   For lngEachDateInRange = lngFirstDateInRange To lngLastDateInRange
    13.     If lngEachDateInRange = rstEvents![Date1] Or lngEachDateInRange = rstEvents![Date2] Then
    14.       bytEventDayOfMonth = (lngEachDateInRange - lngLastOfPreviousMonth)
    15.       bytBlockCounter = bytEventDayOfMonth + bytBlankBlocksBefore
    16.                                               '<Substitute for [Title]>
    17.         If astrCalendarBlocks(bytBlockCounter) = "" Then
    18.           astrCalendarBlocks(bytBlockCounter) = Format$(rstEvents![Time], "hh:nn AM/PM") & vbCrLf & rstEvents![Last] & ", " & _
    19.                                                 Left$(rstEvents![First], 1) & "." & " [" & rstEvents![CodeField] & "]"
    20.         Else                                    '<Substitute for [Title]>
    21.           astrCalendarBlocks(bytBlockCounter) = astrCalendarBlocks(bytBlockCounter) & vbNewLine & _
    22.                                                 Format$(rstEvents![Time], "hh:nn AM/PM") & vbCrLf & rstEvents![Last] & ", " & _
    23.                                                 Left$(rstEvents![First], 1) & "." & " [" & rstEvents![CodeField] & "]"
    24.         End If
    25.     End If
    26.   Next lngEachDateInRange
    27.   'End of CFB added 2-18-10
    28.  
    29.     rstEvents.MoveNext
    30. Loop
  9. Now that we have a Date Range in a Linear Format, we only need to use the Start ([Date1]) and End Dates ([Date2]) - Code Line 13 in above listing.
  10. [Date2] will also include the Time Value associated with the scheduled [Date1] Appointment. This can easily be changed later.
  11. Realizing that this is a whole lot to absorb, I modified the original Data, made the required Code changes, and included as an Attachment the Database I used for this Project. Open the Calendar from the Main Menu and see that both the Start ([Date1]) and End Dates ([Date2]) are now included.
  12. I am sure there will be other questions, so feel free to ask. The only request I make is that you study the Code beforehand.
Attached Files
File Type: zip Wide Calendar with Switchboard.zip (261.0 KB, 86 views)
Oct 8 '13 #6
Thank you. I will study the code and incorporate this calendar with my database. I really appreciate your work!
Oct 9 '13 #7
ADezii
8,834 Expert 8TB
You are quite welcome. There is probably a 'cleaner' method of accomplishing what you want since you are literally creating a Range from the two Dates, processing this entire Range, but only extracting the first ([Date1]) and last ([Date2]) Dates. When I have some time I will look into this further.
Oct 9 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Laphan | last post by:
Hi All Have a couple of quandaries that I was wondering if you could assist on: 1) Created a page whereby the user selects the day, month and year from 3 separate pop-ups rather than all the...
6
by: Michael Hill | last post by:
I have this large array with dates in it. There is a function that sorts it for me. The only problem is that in order for it to get sorted properly I have to sort it AlphaNumerically first using ...
0
by: King Adrock | last post by:
Just thought I'd save anyone some time if they had this problem, before I wrote code like this myCalendar.SelectedDate = myObject.CreatedDate; After upgrade to full RTM I noticed my calendars...
1
by: Daniel Friend | last post by:
I have a program that worked before and now is giving me errors. Can somebody tell me why lblTime.text=microsoft.visualbasic.format(timeofday,"hh:mm tt") Error Message "Not a valid calendar...
1
by: Reidar | last post by:
On a web form I have one calendar control, 2 textfields, FromDate and ToDate. When I click the calendar control I fill the fromDate field with selected date. When FromDate is selected I want to...
1
by: iwongu | last post by:
Hi, I have a question about std::wcout and its underlying C functions. According to C99, a stream have an orientation type that is one of byte-oriented or wide-one, and it is determined by the...
3
by: i3enners | last post by:
Hello I am having problems with the ASP.Net calendar control. I have a style i apply to the selected date which works fine if i load the page then click on a date but when i set the selected date...
3
by: CB Cemetery | last post by:
Hello, I am a student who has developed at database for the Pioneer Cemetery that adjoins our school. I am very inexperienced with Access. I use an input mask to add burial dates mm/dd/yyyy. The...
4
truthlover
by: truthlover | last post by:
I have a DB that tracks the days a certain person is going to be working on a task and I need to be able to choose multiple dates for the task. Is there a way to choose mulitple dates from a...
6
by: FaurKris | last post by:
I've got some Forms and Filters that are opened via a Switchboard when selected. They all work just fine when I open them individually (outside of the Switchboard). The Forms which only have links...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.