LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Date Range problems

Hi,

I have a form with two textboxes for entering a date range. When the user
clicks OK on the form, i validate that the texboxes are dates... this works
fine... then I want to check that the from date is not greater than the to
date, but it is not working consitently. My message is returning that my from
date is greater that my to date even when it isn't. sample code:

If Not IsDate(tbxFrom_Date.Value) Then
MsgBox "The value entered in the From Date field is not a valid Date"
tbxFrom_Date.SetFocus
ElseIf Not IsDate(tbxTo_Date.Value) Then
MsgBox "The value entered in the To Date field is not a valid Date"
tbxTo_Date.SetFocus
ElseIf tbxFrom_Date tbxTo_Date Then
MsgBox "The From Date is greater than the To Date. Please change. "
& _
tbxFrom_Date.Value & " - " & tbxTo_Date.Value
tbxFrom_Date.SetFocus
tbxFrom_Date.Value = ""
Else
'MsgBox "all good"
Unload Me
End If

when I read at my resulting message, the from date is definitely less than
the to date...

ideas?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problems editing data range wn Excel Discussion (Misc queries) 1 September 7th 07 10:52 PM
Range name problems Andrea Jones Excel Discussion (Misc queries) 1 October 18th 06 01:36 AM
Range problems... Neil[_27_] Excel Programming 3 March 24th 05 05:59 PM
Range problems fred 616 Excel Programming 7 May 24th 04 04:11 AM
Variables and range problems athuggard Excel Programming 2 December 30th 03 08:12 PM


All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"