Want cursor to appear in certain text box(simple question but cant figure out)

SD23

Registered User.
Local time
Today, 00:34
Joined
Jun 13, 2006
Messages
60
I have a form. On the form is a pull down box. When the user clicks a submit button on the form, it displays a message box if the name field is not filled out. I want to make it so that after the user clicks 'ok' on the message box, the cursor goes to the name text box so it makes it easier for the user to input his/her name. I would appreciate if some one could help me on this matter. Thank you.
 
I am not sure how to write the code for this. I tried, but the cursor did not appear in the text box I wanted it to. The form is Invention Disclosure, the text box i want the cursor to end up is 'dpre.' Where would I put it in my code. Would I put it where I put the code for the message box. Thanks for the help.
 
is this the same problem that you have asked in the vba section or is this another problem. I have posted a recommendation on the other thread but if this is seperate let me know and I'll help you on it.

Regards
 
Not sure ya need this but Im of to bed now so just in case Ive come up with the following:

Code:
Private Sub submitbutton_Click()

If IsNull(txtname) Then
    If MsgBox("Please enter the necessary information", vbOK, "Missing Info") = vbOK Then Me.txtname.SetFocus
Else:
    DoCmd.RunMacro "exit"
End If
End Sub

Just to explain I have done this in the Click event of your submitbutton. What it does is look to see if the text box where the user must enter their name is empty. If so it will give the message box which has been created (you can customise this to your own needs) which is a OK button. After the user has clicked on this the user is redirected back to the txtname.

However if the user has entered the necessary info then the the macro called exit is ran. If you wish to save the info and then return to the entry page just have a simple macro which closes and opens the form.

Hope this helps give me a shout if ya confused

Mike
 

Users who are viewing this thread

Back
Top Bottom