I need to extract the year part of a date and I have the following code to test
But it gives me a type mismatch when trying to find the Year of mydate. The same problem occurs with the Month function but the Day function works fine. I have used this code before without problem and am now very confused. Any suggestions gratefully received.
Thanks
Code:
Private Sub Form_Open(Cancel As Integer) Dim mydate, myyear mydate = Date myyear = Year(mydate) End Sub
Thanks
Comment