Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is there an easy Copy/Paste of a Userform ? (Entire Userform Including tx & cbx's) | Excel Programming | |||
Userform to enter values and shown in same userform in list | Excel Programming | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Activating userform and filling it with data form row where userform is activate | Excel Programming | |||
Access from add_in userform to main template userform.... | Excel Programming |