From: Sanjay Kulkarni on
Hi,

I have following code in my if 6 program

Const ChkDate as String = "10 Match 2010"

If Now() > CDate(ChkDate) then

msgbox "Send Reminder"

End If

This program runs perfectly on my PC.

I created the exe and sent it to another location. The exe runs
without any
problems on PCs at this location.

The same exe does not run on a PCs at third location. It gives error
No.: 13,
Type mismatch.

I have tried to analyze this problem but unable to understand any
reason why
this error should occur only at third location and how we can resolve
this. All
locations have Win XP. I have also verified that system settings are
similar.

Can anybody suggest the reason and the remedy? Am I overlooking any
particular
system setting?

From: Martin Trump on
>Const ChkDate as String = "10 Match 2010"
>If Now() > CDate(ChkDate) then
>msgbox "Send Reminder"
>End If

>This program runs perfectly on my PC.

I assume 'Match' was a typo. Just a wild guess. Are the locale settings
the same as yours on the errant m/c?

Martin
From: Sanjay Kulkarni on
On Mar 17, 9:38 pm, Martin Trump <mar...(a)wmeadow.demon.co.uk> wrote:
>  >Const ChkDate as String = "10 Match 2010"
>  >If Now() > CDate(ChkDate) then
>  >msgbox "Send Reminder"
>  >End If
>
>  >This program runs perfectly on my PC.
>
> I assume 'Match' was a typo. Just a wild guess. Are the locale settings
> the same as yours on the errant m/c?
>
> Martin

Thanks Martin for pointing out. Yes it was a typo. It should be March.

I have checked the support files and locale settings. Locale settings
are different. So I changed my locale settings accordingly and
executed the Program successfully. So, I don't know what I am missing.

- Sanjay Kulkarni

From: Jason Keats on
Sanjay Kulkarni wrote:
> On Mar 17, 9:38 pm, Martin Trump<mar...(a)wmeadow.demon.co.uk> wrote:
>> >Const ChkDate as String = "10 Match 2010"
>> >If Now()> CDate(ChkDate) then
>> >msgbox "Send Reminder"
>> >End If
>>
>> >This program runs perfectly on my PC.
>>
>> I assume 'Match' was a typo. Just a wild guess. Are the locale settings
>> the same as yours on the errant m/c?
>>
>> Martin
>
> Thanks Martin for pointing out. Yes it was a typo. It should be March.
>
> I have checked the support files and locale settings. Locale settings
> are different. So I changed my locale settings accordingly and
> executed the Program successfully. So, I don't know what I am missing.
>
> - Sanjay Kulkarni
>

Does the following display 18 March 2010 on both machines?
Debug.Print Format$(Now, "d MMMM yyyy")

If not, you could try using
Const ChkDate As String = "2010-03-10"
instead.
From: Jim Mack on
Sanjay Kulkarni wrote:
> Hi,
>
> I have following code in my if 6 program
>
> Const ChkDate as String = "10 Match 2010"
>
> If Now() > CDate(ChkDate) then
>
> msgbox "Send Reminder"
>
> End If
>
> This program runs perfectly on my PC.
>
> I created the exe and sent it to another location. The exe runs
> without any
> problems on PCs at this location.
>
> The same exe does not run on a PCs at third location. It gives error
> No.: 13,
> Type mismatch.


You're running into locale or date format settings issues.

Avoid this entirely by:

Const ChkDate As Date = #3/10/2010#

...

If Now > ChkDate Then

...


Using the #-/-/--# format for literal dates (which always follow the
US convention of d/m/y) eliminates those issues.

--
Jim Mack
Twisted tees at http://www.cafepress.com/2050inc
"We sew confusion"