Maintain focus on a control.

  • Thread starter Thread starter Barry A&P
  • Start date Start date
B

Barry A&P

I am using a combo box control as a data entry point and i want the control
to delete itself after the query runs the data.. if i select the data from
the combos list it works fine but if i type and hit enter it clears itself
but advances to the next control..
here is my code

Private Sub PNIDCombo_AfterUpdate()
DoCmd.SetWarnings False
DoCmd.OpenQuery "Q_TempScanPNIDtoSNID"
DoCmd.Requery "F_TempScanSub"
DoCmd.SetWarnings True
Me!PNIDCombo = Null
Me!PNIDCombo.SetFocus
End Sub

I tried to put
Me!PNIDCombo.SetFocus
in the emter event but it didnt work either

I would only like to advance to next control on TAB not enter..

Thanks For any help
Barry
 
You set the combobox to null. Do you set the recordsource for the combo at
runtime? In that case you can try me.como.recordsource="""and then choose
me.combo.setfocus. And for a last trick you can always set the fosu first on
something else and the set it back to the combo.
 
Maurice

And for your last trick i set the focus elsewhere then back..
Seems goofy but maybe thats how Newbies like myself Scab things together..

another thread suggested creating another control that is next in tab order
set its size to 0" and on its "on enter" event Me!PARTEntryCombo.Setfocus
of course now i cant TAB past the combo but ill live with it
 
Back
Top