Dim myDate As Variant
…
myDate = doc.GetItemValue(“LastModDate”)
If (Cdat(myDate) <>Today()) Then…
I am getting a “Type Mismatch Error”
Please suggest.
Dim myDate As Variant
…
myDate = doc.GetItemValue(“LastModDate”)
If (Cdat(myDate) <>Today()) Then…
I am getting a “Type Mismatch Error”
Please suggest.
Subject: Cdat() by itself can already trigger a type mismatch
We had the experience that CDat was generating type mismatches for ambiguous string dates like 2001-11-01 in the format dd.mm.yyyy.
CDat internally was expecting them in the mm-dd-yyyy format. Check the International settings of the .DEFAULT user if this corresponds to your regular date formats.
Just try if a CDat() by itself without the “if” part already gives an error.
Subject: (Cdat(myDate) <>Today()) Type Mismatch Error ??
Problem the content of the variable ‘myDate’ mismatches any of the following kinds of expression:* A numeric expression
A string expression that can be converted to a number
A string expression that can be converted to a date/time value
Can you post it?
Subject: RE: (Cdat(myDate) <>Today()) Type Mismatch Error ??
Hi
thanks.
What I am trying is
to get the value of a Date Field - (LastModDate) into a variant
Then I need to do the comparision with Today() in IF condition
can you please send some sample…how to do this?
Subject: RE: (Cdat(myDate) <>Today()) Type Mismatch Error ??
Try using:
myDate = doc.LastModified
Or, if you really need that field you created use:
myDate = doc.LastModDate(0)
Hope this helps.
-Gabriel
Subject: You need MyDate(0) since it is a variant
Dim myDate as StringmyDate = doc.GetItemValue(“LastModDate”)(0)
or…
refer to myDate(0) with your code as you have it, since it is a variant… you have to do the (0) or it will puke every time.
Good luck.
Trish