Looping a textbox

L

LRay67

I need to create a loop that doesn't allow the user to leave the textbox
until it is filled. Below is what I have coded for the message box but would
like to include the loop until textbox is filled. Also if possible would
like this field to be visited without the LostFocus aspect of it. Any
Suggestions?

Private Sub Textbox8_LostFocus()
If TextBox8 = "" Then
MsgBox "Please enter Submitting Agency Name"
Exit Sub
End If
End Sub
 
F

FSt1

hi
you don't really need a loop for this. just prevent the user from leaving
the text box.
add this line to your code just just after your message box and before the
exit sub commmand.

Textbox8.activate

this will put the curser back into the text box.

regards
FSt1
 
J

Joel

Private Sub Textbox8_LostFocus()
do while TextBox8 = ""
response = inputBox "Please enter Submitting Agency Name: "
TexBox8 = response
loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top