Casting error.

Using the following code:

modFileName = ("TEMP_" + date.year.ToText.mid(2) + results.Lookup(lstBoxImages.ColumnTag(0), ""))

I get a Type Mismatch Error of “Expected Text but got String”

How do I cast the above line of code so it returns as text? I’ve tried dimming modFileName as Text, but that didn’t work.

It’s because you are converting the year to Text. Change that part to ... + Str(date.Year mod 100) + ...

(I took some liberties with your intent here.)

George Clooney as Batman was the largest casting error I am aware of :slight_smile:

[quote=431144:@Kem Tekinay]It’s because you are converting the year to Text. Change that part to ... + Str(date.Year mod 100) + ...

(I took some liberties with your intent here.)[/quote]

Thanks @Kem Tekinay !!!