Majp, in reference to thread702-1723375 that was closed I remember I asked how to highlight the current day and you gave me some code to do so and I never incorporated it into my database at the time. Im wanting to try it and I dug threw the thread and found the vba below. I cant seem to get it to work without some errors. I call it in the on load event and I get an err 2465 saying it cant find 'txtDec33' referred in my expression.
I debug and it takes me to:
Set GetTodaysTextBox = Forms("Frm_YearCalendar").Controls(txtBxName)
the Debug.Print txtBxName is "txtDec33" and Debug.Print offset is "5" it is picking the correct month and day everywhere. Thoughts?
Thanks...
Thanks,
SoggyCashew.....
UPDATE: I changed vbSaturday to vbSunday because my calendar starts on Sun - Sat and now the txtBxName is "txtDec32" which if you count the text boxes its todays day so that's correct. But I still get the same error just now with "txtDec32".
I debug and it takes me to:
Set GetTodaysTextBox = Forms("Frm_YearCalendar").Controls(txtBxName)
the Debug.Print txtBxName is "txtDec33" and Debug.Print offset is "5" it is picking the correct month and day everywhere. Thoughts?
Thanks...
Code:
Public Sub TestHilite()
GetTodaysTextBox.BorderColor = vbYellow
End Sub
Public Function GetTodaysTextBox() As Access.TextBox
Dim CurrentDay As Date
Dim strMonth As String
Dim offset As Integer
Dim txtBxName As String
CurrentDay = Date
strMonth = Format(CurrentDay, "mmm")
'Debug.Print strMonth
offset = getOffset(Year(CurrentDay), Month(CurrentDay), vbSaturday)
Debug.Print offset
txtBxName = "txt" & strMonth & offset + Day(CurrentDay)
Debug.Print txtBxName
Set GetTodaysTextBox = Forms("Frm_YearCalendar").Controls(txtBxName)
End Function
Thanks,
SoggyCashew.....
UPDATE: I changed vbSaturday to vbSunday because my calendar starts on Sun - Sat and now the txtBxName is "txtDec32" which if you count the text boxes its todays day so that's correct. But I still get the same error just now with "txtDec32".