Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Focus 1

Status
Not open for further replies.

Mr2006

Technical User
Jun 21, 2006
80
0
0
US
Hello,

I have the following codes in the load event. If the purchase date field is not null, the user must choose something from the combobox (shipping needed). Right now, the box pop up but if we select Ok in the msgbox, it close the form. I want to be able to have the cursor set in the combobox to make the choice and not to close the form till something is selected.

If Not IsNull(Me![Purchase Date]) And IsNull(Me![Shipping Needed]) Then
MsgBox "You must make a selection in Shipping Needed!"
Me![Shipping Needed].SetFocus
Cancel = True
End If

Any suggestions?

Thanks
 
Try:

Code:
If Not IsNull(Me![Purchase Date]) And IsNull(Me![Shipping Needed]) Then
      MsgBox "You must make a selection in Shipping Needed!"
      Me![Shipping Needed].SetFocus
      [red]exit sub[/red]
End If

JB

 
Thank you so much. It worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top