Notesdatetime type mismatch

I’m getting a type mismatch when setting monBankHolChkI know I’m missing something obvious but my brain is old and haggard!! Please save my sanity!

Dim monBankHolChk As Variant

Dim friBankHolChk As Variant

Set friBankHolChk = New NotesDateTime (entry.created)

(entry is the document that is currently being targeted)

Set monBankHolChk = New NotesDateTime (cDat(friBankHolChk))

Thanks

Jon

Subject: notesdatetime type mismatch

The NotesDateTime constructor takes the date as a string, so you need to cast the Date value you get from NotesDocument.Created to a string.

Try this:

Dim monBankHolChk As NotesDateTime

Dim friBankHolChk As NotesdateTime

Set friBankHolChk = New NotesDateTime (Cstr(entry.created))

Set monBankHolChk = New NotesDateTime (Cstr(friBankHolChk))

As you see above, I would also suggest to declare the variables as the correct data type from the beginning, don’t use Variant unless it is absolutely needed.

Finally, I would use the variable name ‘doc’ for a NotesDocument object, not ‘entry’. That name I reserve for objects of the type NotesViewEntry. Things like that makes the code easier to read, especially if you have other people looking at it or maintaining it.

Subject: RE: notesdatetime type mismatch

Thank you Karl

I very rarely do any lotus script so I’m quite rusty.

Thanks for the tips.