Type Mismatch

  • Thread starter Thread starter Mark A. Sam
  • Start date Start date
M

Mark A. Sam

In the following code,

If IsNull([Year]) Or [Year] = "" Then
[Year] = Year(Date)
Else
[Year] = [Year] + 1
End If

I get Runtime Error 13, Type Mismatch, which refers to the function,

Year(Date)

Executing this in the immediate window, ?Year(Date) returns 2005.

I don't know what could be causing this. I ruled out the field name [Year]
as being the problem. Thanks for any help.

God Bless,

Mark A. Sam
 
Well, rule it back in again, because that is exactly what the problem is. If
you need proof, try this ...

Private Sub Command8_Click()

If IsNull([Year]) Or [Year] = "" Then
[Year] = VBA.Year(Date)
Else
[Year] = [Year] + 1
End If

End Sub
 
Mark A. Sam said:
In the following code,

If IsNull([Year]) Or [Year] = "" Then
[Year] = Year(Date)
Else
[Year] = [Year] + 1
End If

I get Runtime Error 13, Type Mismatch, which refers to the function,

Year(Date)

Executing this in the immediate window, ?Year(Date) returns 2005.

I don't know what could be causing this. I ruled out the field name
[Year] as being the problem. Thanks for any help.

God Bless,

Mark A. Sam

Mark, this is different than your post at 1:29 today. Which one are we
troubleshooting?
 
Back
Top