|
-
Feb 17th, 2010, 03:58 PM
#1
Thread Starter
Fanatic Member
Monthview Control - Using Left & Right Arrows to Choose Month
My project uses a monthview control to allow the user to select a date for their data entry. I also have a function that bolds the dates on the monthview control so that the users can see where they've entered data already.
The function itself works perfectly (I'll post it's code at the bottom of my post), but I there's one tiny issue. If the user clicks the left and right arrows at the top of the monthview control to navigate through different months, it works. If they click through the months too fast though, it doesn't work.
For example, let's say I have data entered for January 2 and February 2, 2010. If my calendar control is set to December 2009 and I slowly click the right arrow it will show Jan 2, 2010 in bold and then Feb 2, 2010 in bold. However, if my monthview is in December and I click twice quickly, it shoots me through to Feb, 2010 but the 2nd is not bolded.
I assumed I needed to call the function below from the "double-click" event on my monthview control but of all the events I've tried, none seem to correct the problem. Any ideas?
Code:
Public Function PopulateDateBoldArray(ByVal strCRNumber As String, strReviewDate As Date)
'This function highlights the dates on the main form calendar where review data is present
Dim rsDateList As ADODB.RecordSet
Set rsDateList = New ADODB.RecordSet
Dim strDate As String
Dim strSQL As String
Dim intCount As Integer
intCount = 0
'Erase DatesToBold()
'CalendarMonth = frmMain.monReviewDates.Month
strDate = Format(strReviewDate, "MM/DD/YYYY")
strSQL = "SELECT Location.Location_Date " & _
"FROM Master_Review INNER JOIN Location ON Master_Review.ID = Location.ID " & _
"Where Master_Review.CR_Number = '" & strCRNumber & "' And Master_Review.Review_Date = " & "#" & strDate & "#" & _
"ORDER BY Location.Location_Date"
With rsDateList
.Open strSQL, conAccess, adOpenStatic, adLockOptimistic
' ReDim DatesToBold(.RecordCount) As Date
Do While Not .EOF
If DatePart("m", frmMain.monReviewDates) = DatePart("m", .Fields!Location_Date) Then
frmMain.monReviewDates.DayBold(.Fields!Location_Date) = True
End If
.MoveNext
intCount = intCount + 1
Loop
End With
Set rsDateList = Nothing
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|