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: 68
Default Restriction for the Date Field in UserForm


I have a UserForm and I put the restriction on the "DatePurchase"
textbox. so user can not skip this field. it is working fine. I used
the following code for that.


Private Sub DatePurchase_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(DatePurchase) Then
MsgBox "Input must be a date in the format: 'dd/mmm/yyyy'"
Cancel = True
Else
DatePurchase = Format(DatePurchase, "dd/mmm/yyyy")
End If
End Sub



Private Sub CloseForm_Click()

Unload Me

End Sub


when I Load the UserForm and I dont want to go for entry and I want to
close this form by close button, with Unload me command. then my
userform is not going to close at all, unless I feed the Date in
"DatePurchase" Field.

when I hit the close button without feeding the Date, the Input
message is appearing. "Input must be a date in the format: 'dd/mmm/
yyyy'"

I want my Form to be close when I hit the close button


Pls give me any suggession.......

Regards.

Shahzad
 
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
Date and User restriction coding PSM[_19_] Excel Worksheet Functions 1 November 19th 09 07:03 PM
New date based on one date field minus minutes in another field [email protected] Excel Discussion (Misc queries) 1 December 25th 07 04:05 PM
Linked date field in worksheet defaults a blank field as 1/0/1900 AmnNkD Excel Worksheet Functions 2 September 12th 06 05:42 PM
Converting a date field into a month-year only field C.Hirsch Excel Discussion (Misc queries) 1 April 25th 06 12:08 AM
How to Join/concatenate a date field with a time field in Excel? Alan Excel Discussion (Misc queries) 4 August 9th 05 10:07 PM


All times are GMT +1. The time now is 03:02 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"