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: 9
Default How to get User input from Userform Text box

Thank you for the response. I (newbie) am confused about the flow. Is it

cmbGo_Click ( )
txtStopDate.SetFocus
txtStopDate.Start = 0
txtStopDate.SelLength =8
Call ValidateDate
End

ValidateDate ( )
'Test for validity of date

If DateFound = 0 Then Inform user and Exit
....
End

The User enters a date and clicks the Go button.
The Click checks the length of the text entry (=8) and calls the procedure to
validate the date?
The ValidateDate procedure finds an error (informs the user) and exits?

Thanks


Ronald Dodge wrote:

The side affect that you are seeing is probably a result of the code
constantly running with the Do...Until code, thus not refreshing the screen
as you would like it to. To avoid this sort of issue, 2 things to consider:

Setup a command button and use as the default button for when the date is
entered (if not already done),

and

If the data validation did not pass on the date entry, use the SetFocus
within the command button's click event on the Date's textbox object, then
set the SelStart and SelLength properties on the textbox.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"K" wrote in message
...
In this situation the User inputs an invalid date in a Userform text
box, the program then requests a valid date.

I used the Do Until command to pause the program
while the User inputs the new date. However, the UserForm disappears (or
partially visible and
stuck) so its not possible to make the change. I tried UserForm1.Show
as shown in the coding
below, but this yields an error (the Userform is already showing).
Appreciate any suggestions.

If DateFound = 0 Then 'The date provided is not valid
LabelMessage.Caption = "Database does not contain specified Stop Date.
Please enter new Stop Date"

txtStopDate.Value = "" 'Clear the text box containing the
wrong date
txtStopDate.SelStart = 0
txtStopDate.SelLength = Len(txtStopDate.Text)
txtStopDate.SetFocus

Do Until Len(txtStopDate) = 8 'Check that the text box
contains a date
UserForm1.Show 'This code creates an error
Loop
GoTo StopDate 'This validates the newly provided

End If




 
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, with no input pgarcia Excel Discussion (Misc queries) 0 September 14th 07 05:02 PM
Prompt user for input and utilize that input ninner Excel Worksheet Functions 2 March 28th 07 09:44 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
Formatiing a input Box in a Userform Jeff Excel Discussion (Misc queries) 0 April 13th 06 08:57 PM
Use userform to get input and compare to a hidden sheet cwwolfdog Excel Discussion (Misc queries) 11 March 24th 05 12:45 AM


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