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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set focus on a field list

Status
Not open for further replies.

NC1977

Programmer
Nov 26, 2007
22
CA
I have a form with a field list. Once the user selects from that list, he can then proceed to another form to enter additional information. I would like for it to be impossible to continue to the other form without having selected from my field list.

How can I do this??

Thank you
 
How does the user proceed to the next form?

If it's by using a button then how about only enabling the button once a value has been selected from the field list?

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
It is a command button...Would you this in the Afterupdate property of my field list???

Thanks
 
Yeah, that should work.

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Use the Before Update Event for the Form.

If IsNull(Me.yourselection) Then
MsgBox "Please Make a Valid Selection"
Me.Selection.GotFocus.
End If
 
How are ya NC1977 . . .

Try this in the command button:
Code:
[blue]   Dim Msg As String, Style As Integer, Title As String
   
   
   If Trim(Me![purple][b][i]ListboxName[/i][/b][/purple] & "") = "" Then
      Msg = "Selection required from FieldList!"
      Style = vbInformation + vbOKOnly
      Title = "No Selection Error! . . ."
      MsgBox Msg, Style, Title
      Me![purple][b][i]ListboxName[/i][/b][/purple].SetFocus
   Else
      DoCmd.OpenForm "FormName"
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top