SetFocus on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I am attempting to turn one command button off and another on on the same form
I am having difficulty with the setfocus. I am trying to setfocus to my subform, then apply the command buttons settings, and repaint the main form. I can’t get past the first setfocus. And the debugger does not recognize the name of my subform.

The main form name is frmNodes, the subform name is fsubCost.

===== code =======

Forms!fsubCost.SetFocus ‘ set focus to subfor

Me!cmdUpdate.Visible = False ‘ hide Update butto
Me!cmdSave.Visible = True ‘ display Save butto

Forms!frmNodes.SetFocus ‘ set focus back to main for
Me.AllowEdits = True ‘ turn edits o
Me.Repaint ‘ repaint the form with the Save butto

====== end code ==========

Thanks
Mik
 
You must use the name of the subform control (the actual control that holds
the subform), not the name of the subform control's source object.

I'm guessing that fsubCost is the name of the form that you are using as the
subform, and is not the name of the subform control.

--
Ken Snell
<MS ACCESS MVP>

Mike P said:
Hello,

I am attempting to turn one command button off and another on on the same form.
I am having difficulty with the setfocus. I am trying to setfocus to my
subform, then apply the command buttons settings, and repaint the main form.
I can't get past the first setfocus. And the debugger does not recognize
the name of my subform.
 
subform control = the actual control that holds the subform

When you open your main form in design view, the subform is actually
contained inside a control. That is the control that is the subform control.
Click on the outside edge of that control (big rectangle) and look at the
name of the control in the Properties window.
 
Back
Top