Nope, it's 100% assuredly that piece of the code.
I had a "where" statement buried in a "DLookup" that included " AND [Year] =
" & Year(Now).
I started getting errors. When I cut that small piece of code out, the
errors stopped.
Then, instead of adding the code back in, I started using that "Year"
Function, declaring specific data types, etc. to try and figure it out
myself. I was using popup message windows to look at how the variables were
being defined in my subroutine.
That specific statement is where the errors appeared every time, and any
time I cut it out, I get no errors.
Also, before posting here, I ran the subroutine, just as posted, and got the
errors I mentioned.
If that's not causing errors for you guys, then I hope it's just some quirk.
I'll do the Windows thing and close down vBasic, Access, log off my
computer, reboot it and see if that fixes it. If not.... I'll be back.
Brendan Reynolds said:
While I would recommend explicitly declaring the data types of your
variables, that doesn't seem to be the immediate problem here - I copied and
pasted your code, and it runs without error for me. But presumably this is
not all of your code (as it doesn't do anything). Perhaps the problem is in
the part of the code that you didn't post?
--
Brendan Reynolds (MVP)
What am I missing here. I feel stupid for asking, but I'm trying to use a
search criteria on some code where the current year is the filter
criteria.
It never allows me to assign the current year -
Private Sub List0_AfterUpdate()
Dim RID, Yr, Today
Today = Year(Now)
End Sub
I get a "type mismatch" error. Why?