SOLVED.
Here's the code, really simple!
Dim DDay as integer
Dim Default as Date
Default = CDate(Int(Now()))
DDay = Day(Default) - debugger highlights this line
part 1
I copied the code behind a command button in one form that was working perfectly. Pasted it for another command button and I get Error 13 type mismatch!!! The original still works fine.
Both are forms. The one that works fine is just a simple form. The one that gives the type mismatch has 2 subforms on it. Neither DDay, nor Default are fields in the forms, just used within the coding.
Am I being really stupid somehow?
ETA - YUP, STUPID!!! Had a field called 'DAY' in the second form. I've been using this file for over a year, and been getting rid of macros and inserting VB in their place.
It was a BIG job to locate ALL the references to that 'Day' throughout queries, tables etc, and change them all to DayNum, but it's done now.
later that day.........
Thought that'd be it, but NOOOOOO
Part 2
Now, instead of an error saying 'type mismatch', the debugger says that it can't find the field referred to in the expression!
after more searching the net.............
Part 3
Solved!
First, in case 'Default' was a reserved word, changed it to Defolt.
Didn't solve the problem.
Shoving "VBA." in front of the Day function, i.e. DDay = VBA.Day(Defolt) solve the problem.
Thanks for being here anyway.