I was looking at your expression and can't see anything wrong. I was confused a little with the dates so I rewrote it a little. I added parentheses to ensure groupings and used the Between keyword.
Code:
IIf(([BeginDate]<#1/1/2009#) And ([EndDate]>#1/1/2010#),365, IIf(([BeginDate]<#1/1/2009#) And ([EndDate] Between (#1/1/2009# + 1) And #1/1/2010#), DateDiff("d",#1/1/2009#,[EndDate]), IIf(([BeginDate] Between #1/1/2009# And (#1/1/2010# - 1)) And ([EndDate]>=#1/1/2010#),DateDiff("d",[BeginDate],#1/1/2010#), IIf(([BeginDate] Between #1/1/2009# And (#1/1/2010# - 1 )) And ([EndDate]<#1/1/2010#),DateDiff("d",[BeginDate],[EndDate]), 0))))
Do the numbers match your original expression?
Have you tried just
Code:
IIf(([BeginDate]<#1/1/2009#) And ([EndDate]>#1/1/2010#),365, 0)
and filter on the numbers?
If that works, keep adding one IIF() statement until you get the error.