Add to AfterUpdate

B

Bob

I want to add this to AfterUpdate so as when I select My ActiveHorse in
HorseInfo it will set focus on lbBottomBox

Private Sub cbActiveHorses_AfterUpdate()
If CurrentProject.AllForms("frmHorseInfo").IsLoaded = True Then
DoCmd.Close acForm, "frmHorseInfo"
End If
If cbActiveHorses = "" Or IsNull(cbActiveHorses) Then Exit Sub
DoCmd.OpenForm "frmHorseInfo", acNormal, , , , , "FromMain"
lbBottomBox.SetFocus
End Sub

Thanks for any help....Bob
 
J

JK

Bob,
What is the question? ;-)

Just guessing (untested):

Private Sub cbActiveHorses_AfterUpdate()
If CurrentProject.AllForms("frmHorseInfo").IsLoaded = True Then
DoCmd.Close acForm, "frmHorseInfo"
End If
If cbActiveHorses = "" Or IsNull(cbActiveHorses) Then Exit Sub
DoCmd.OpenForm "frmHorseInfo", acNormal, , , , , "FromMain"

DoCmd.SelectObject acForm,"frmHorseInfo" '****** Add this
DoCmd.GoToControl "lbBottomBox" '****** Add this
' lbBottomBox.SetFocus '******Remove
End Sub

Regards
Jacob
 
B

Bob

Worked perfect Jacob, it all might seem a bit Irish but my form is double
size ;so now I have a way from main menu to go directly to the bottom half
of my form. then on my form I now have a top and a bottom setfocus list box
so the button take me to the top or bottom hmmmmm...It works LOL thanks Bob
 
B

Bob

Ooops that didnt work so created a new query and Combobox, changed the after
and PRESTO

Private Sub cbHorseRemarks_AfterUpdate()
DoCmd.OpenForm "FrmHorseInfo", , , "HorseID =" & Me.cbHorseRemarks
DoCmd.SelectObject acForm, "frmHorseInfo"
DoCmd.GoToControl "BottomBox"
End Sub

Thanx Bob
 

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