LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default UserForm

What I think you're doing....
1. You have a userform you created that has a button or two that checks
textboxes where you want folks to entere dates. If they entere dates
that are not valid, you pop up a message box to tell them. THE PROBLEM
is that once they click thorugh the message box, the form is blanked
out or unloaded or you just can't see it.

What I think you want to do....
A. Warn them
B. Don't dump the form

Get rid of the code "call main program"

All you need to do is run the code to check if it is a date or not then
pop the msgbox. Nothing else.



If you don't really care what info they put in there and just want to
warn them, highlight the text box when the exit the box.
Something like this:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(TextBox1.Value) = False Then
TextBox1.BackColor = &HFF&
Else
TextBox1.BackColor = &HFFFFFF
End If
End Sub

if you really want to force them to enter the date appropriately,
(assuming you have a final button or routine they click to save their
entry....) just enter a snip of code in the routine that goes something
like this...

sub savebutton_click()
Dim DateFlag As Boolean
If IsDate(TextBox1.Value) = False Then DateFlag = True
If IsDate(TextBox2.Value) = False Then DateFlag = True
If IsDate(TextBox3.Value) = False Then DateFlag = True

If DateFlag = True Then
MsgBox "You need to enter the right date in the red boxes":
Exit Sub
End If
end sub

=====
Regards,
Jamie



 
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
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
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM


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