like using IsMissing when appropriate on the argument list of a subroutine or function. But I keep forgetting that I have to then declare that variable as a variant.
Good: Sub SendQuerytoExcel(strQuery As String, Optional strXLSName As Variant, Optional strSheetName As Variant)
Bad: Sub SendQuerytoExcel(strQuery As String, Optional strXLSName As String, Optional strSheetName As String)
If you forget then the string comes in as a zero length string, that is "". And, of course, it's not missing. Yes, yes, I know the help tells you this. It's just that i keep forgetting.
And it sure would be nice if the Microsoft Access team could put this in the VBA compiler. After all if a field is optional it must be variant to be of any use.
My apologies if this is a duplicate as the blog server lost this entry so I had to repost it.