Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Returning focus to a user form after getting message box response

I have created a user form, and I'm at the stage where I'm programming the
data entry validation. I'm getting the message box to display when the user
hasn't enter what was expected, but then I can't get the code to return the
focus to the form itself to allow the user to correct the data entry. Any
suggestions?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Returning focus to a user form after getting message box response

Lets see your code then maybe we can help

"Capt. Bangs" wrote:

I have created a user form, and I'm at the stage where I'm programming the
data entry validation. I'm getting the message box to display when the user
hasn't enter what was expected, but then I can't get the code to return the
focus to the form itself to allow the user to correct the data entry. Any
suggestions?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Returning focus to a user form after getting message box respo

This probably isn't very elegant: I'm a newbie. But I appreciate your offer
of help.

GoodData = False 'ensures that the loop starts

Do Until GoodData
If txtUserEmail.Value Like "*_*" Then 'checks to make
sure that the user's name is in the form "firstname_lastname"
GoodData = True
Else
If txtUserEmail.Value Like "* *" Then 'if the e-mail
address is missing the underscore
txtUserEmail.Value = LTrim(txtUserEmail.Value)
txtUserEmail.Value = Replace(txtUserEmail.Value, " ", "_")
'the program replaces a space with an underscore
GoodData = True
Else
If txtUserEmail.Value = "" Then 'if the user has not
entered a name in the text box
Dim Answer As VbMsgBoxResult
Answer = MsgBox("You have not entered your e-mail
address.", vbOKCancel)
If Answer = 2 Then
Exit Function
End If
Else
If Answer = 1 Then
txtUserEmail.SetFocus
End If
End If
End If
End If
Loop

"Mike" wrote:

Lets see your code then maybe we can help

"Capt. Bangs" wrote:

I have created a user form, and I'm at the stage where I'm programming the
data entry validation. I'm getting the message box to display when the user
hasn't enter what was expected, but then I can't get the code to return the
focus to the form itself to allow the user to correct the data entry. Any
suggestions?

Thanks!

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
Setting focus on User Form Listbox Don Wiss Excel Programming 4 August 26th 06 03:16 AM
set focus on user form jhahes[_2_] Excel Programming 1 June 1st 05 09:26 PM
User Form focus Glen Mettler[_2_] Excel Programming 3 October 10th 04 05:31 PM
Modeless User Form and Worksheet Focus JWolf Excel Programming 2 May 26th 04 08:27 PM
Text Box on User Form Set Focus Issue John Flynn Excel Programming 0 September 6th 03 02:41 PM


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