RE: Setfocus to a textbox



Hi

You did not mention a subform in your post ?

If you want to set the focus to a field on a subform from a main form you
have to do this in 2 stages.

1st set the focus to the sub form
2nd set the focus to the field

If you can let me know some details - where are you trying to "fire" the
event from. name of the main form, name of the sub form, etc. I can send
back the code.

I may have misunderstood but I think you are trying to do "something" on a
main form that will clear the details (check box) om a subform - hope this is
right.

--
Wayne
Manchester, England.
Enjoy whatever it is you do


"Marcus Lloyd" wrote:

By adding 'Me', the same fault happens.

But I think its to do with a linked subform updating from a textbox after
the OnExit event has completed. Can't find an event for after the subform
updates, tried AfterUpdate but it does not trigger?

"Wayne-I-M" wrote:

Hi Marcus

txtLPN.SetFocus
txtLPN.Text = ""

Should be

Me.txtLPN.SetFocus
Me.txtLPN =" "


Hope this helps
--
Wayne
Manchester, England.
Enjoy whatever it is you do


"Marcus Lloyd" wrote:

Hi,

I have a form that has a textbox, subform, and a MSFlexGrid.

On Exit from the textbox I have code that adds the records to the flexgrid
after some processing, opening connections and recordsets to the DB.

At the end of the code the last thing the code does is to clear down the
textbox and sets the focus to it.

txtLPN.SetFocus
txtLPN.Text = ""
txtLPN.SetFocus

After the code executes the SetFocus method is called but the focus does not
set to the textbox.

I've also tried using DoCmd.GoToControl "txtLPN", but still the focus is not
on the textbox control.

Any ideas?


.



Relevant Pages

  • Re: refresh an open form using records from another open form?
    ... Yes, I made the linking textbox visible, and yes the record ID's match ... It's as if the subform only wakes up when I click on it?... ... I click a control on the 'frm_Road_Junctions' form. ... Did you set up the master/child link for the subform control containing ...
    (microsoft.public.access.formscoding)
  • Re: Referencing problem
    ... to return a reference to the form the tab is embeded in. ... If the tab is on a subform, ... You can't use the Me operator or the form reference returned by Me ... located on this subform and the textbox is located on the ...
    (comp.databases.ms-access)
  • RE: Setfocus to a textbox
    ... SetFocus to txtLPN ... txtCurrentASN - Textox on the Main Form ... The subform is linked to txtCurrentASN by Master/Child feilds. ... triggering after the On_Exit event of the textbox? ...
    (microsoft.public.access.forms)
  • Re: refresh an open form using records from another open form?
    ... Are you saying that you see the value in the textbox changing, ... It's as if the subform only wakes up when I click on it?... ... I click a control on the 'frm_Road_Junctions' form. ... Did you set up the master/child link for the subform control ...
    (microsoft.public.access.formscoding)
  • Re: Help with form/subform problem?
    ... subform and put a new textbox as you suggested. ... I've got a form called frmCust that has a subform on it ... if the customer's balance is NOT zero. ...
    (comp.databases.ms-access)