Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Ambiguous Dates Crashing VBA User Forms

Hello,

I'm currently using a User form in a project Portfolio spreadsheet, and i'm having issues with dates (Communial groan)

I have a field with the below logic applied to it:

Code:
Private Sub Requested_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
'Confirms date format, and sets to standard format if valid date
If IsDate(Requested) Then
        Requested = CDate(Requested)
        End If
End Sub

Private Sub Requested_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'Confirms date format, and sets to standard format if valid date
If IsDate(Requested) Then
        Requested = CDate(Requested)
        Else
        Requested.Value = ""
        MsgBox "Date requested / logged must be a valid date (dd/mm/yyyy)", vbInformation + vbOKOnly, "Date Incorrect"
        End If
End Sub
If a user enters a date such as "15/12/2014", i.e. it can only be format dd/mm/yyyy, everything is ok. If they enter an 'ambiguous' date, such as '01/12/2014' the form freezes on exit of the field.

If a place a break point in the code at any point, it makes no difference. The code doesn't even it get called before the freeze, it seems. the only way to get out of this is killing the excel process in task manager. killing the program itself doesn't work, as it's still expecting data in the user form.

i've tried building test cases, using the same data, but NOT in a user form, and i think it's an 'overflow' error message, but that doesn't help me. Somebody suggested changing the 'CDate' to 'Cdbl' but as i suspected, this just caused a mismatch error. Anyone had the same issue, and managed to work around it?
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
User Form Crashing Excel Troubled User Excel Programming 2 August 19th 08 04:58 PM
Problem with Excel crashing when opening an user form James Excel Programming 0 July 18th 06 10:39 PM
VBA Forms in Excel crashing on exit? Dom[_3_] Excel Programming 6 March 6th 06 09:49 AM
Use of forms in Excel causes crashing Arjen Leine Excel Programming 3 November 5th 04 04:09 PM
Excel 2003 hangs with dates in user forms hlask Excel Programming 0 June 3rd 04 09:21 AM


All times are GMT +1. The time now is 11:43 AM.

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

About Us

"It's about Microsoft Excel"