#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default Userform

Hi,

I've got a userform with different textboxes, I'm using the following code
to insert the dates into the textboxes and to validate that date B is not
less or equal to date A:

If ALLOCATION.ComButton3.Caption = "X" Then
ALLOCATION.TextBox21.Value = Calendar1.Day & TextBox1.Value & "Z" & n &
Calendar1.Year
ALLOCATION.TextBox151.Value = Calendar2.Day & TextBox2.Value & "Z" & m &
Calendar2.Year
frmCalendar.Hide
If ALLOCATION.TextBox151.Value < ALLOCATION.TextBox21.Value Or _
ALLOCATION.TextBox151.Value = ALLOCATION.TextBox21.Value Then
MsgBox "msg"
ALLOCATION.TextBox151.Value = ""
frmCalendar.Show
End If
Unload Me
ALLOCATION.ComButton3.Caption = "Y"

My problem is that when I have 141315ZMAR2008 as my first date (A) I'll get
the warningmessage if date B is 141315ZJUL2008, so for some way the code only
looks at the first part of the date, instead of the complete part.

Does anybody have an idea?

Cheers,

Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Userform

You may consider (A) 141315ZMAR2008 and (B) 141315ZJUL2008 to be dates but
since they are not in a date format that VB recognizes they are just strings
to it.

Since at the first point they differ, character 8, (B) has "J" and (A) has
"M", VB considers B to be less than A.

--
Jim
"Paul" wrote in message
...
| Hi,
|
| I've got a userform with different textboxes, I'm using the following code
| to insert the dates into the textboxes and to validate that date B is not
| less or equal to date A:
|
| If ALLOCATION.ComButton3.Caption = "X" Then
| ALLOCATION.TextBox21.Value = Calendar1.Day & TextBox1.Value & "Z" & n &
| Calendar1.Year
| ALLOCATION.TextBox151.Value = Calendar2.Day & TextBox2.Value & "Z" & m
&
| Calendar2.Year
| frmCalendar.Hide
| If ALLOCATION.TextBox151.Value < ALLOCATION.TextBox21.Value Or _
| ALLOCATION.TextBox151.Value = ALLOCATION.TextBox21.Value Then
| MsgBox "msg"
| ALLOCATION.TextBox151.Value = ""
| frmCalendar.Show
| End If
| Unload Me
| ALLOCATION.ComButton3.Caption = "Y"
|
| My problem is that when I have 141315ZMAR2008 as my first date (A) I'll
get
| the warningmessage if date B is 141315ZJUL2008, so for some way the code
only
| looks at the first part of the date, instead of the complete part.
|
| Does anybody have an idea?
|
| Cheers,
|
| Paul


Reply
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
Is there an easy Copy/Paste of a Userform ? (Entire Userform Including tx & cbx's) Corey Excel Programming 2 January 9th 07 01:01 PM
Userform to enter values and shown in same userform in list helmekki[_104_] Excel Programming 0 November 19th 05 03:23 PM
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Activating userform and filling it with data form row where userform is activate Marthijn Beusekom via OfficeKB.com[_2_] Excel Programming 3 May 6th 05 05:44 PM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM


All times are GMT +1. The time now is 09:01 AM.

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"