Buona sera Alessandro,
ti allego immagine errore dopo inserimento
Private Function get_events(p_date As Date) As Long
If DCount("*", "impegni", "giorno=#" & p_date & "#") = 0 Then
get_events = 16711680
Else
get_events = RGB(255, 255, 0)
End If
End Function[/code]
e sostituzione della riga
ctl.ForeColor = 16711680
con la riga
ctl.ForeColor = get_events(DateSerial(intYear, intMonth, intJ))
questo è l'errore che mi dava:
e questo è il codice che ho inserito:
Option Compare Database
Option Explicit
Dim intFirst As Integer, intLast As Integer, intLastDay As Integer
Dim intMonth As Integer, intYear As Integer
Dim intJ As Integer Dim varDate As Variant
Private Function get_events(p_date As Date) As Long
If DCount("*", "impegni", "giorno=#" & p_date & "#") = 0 Then
get_events = 16711680
Else
get_events = RGB(255, 255, 0)
End If
End FunctionSub ResettaColore(CodToggleButton As String)
Dim i As ToggleButton
For Each i In Me.optCalendar.Controls
If Right(i.Name, 2) = CodToggleButton Then
Else
If i.ForeColor = 255 Then 'Rosso
ctl.ForeColor = get_events(DateSerial(intYear, intMonth, intJ)) 'i.ForeColor = 16711680 'Blu
End If
End If
Next i
End Sub
In rosso ho aggiunto, non mi da errore ma non evidenzia le date con impegni
Grazie
Francesco
S.O. Windows 10 e Office 2007