SetFocus on a form

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
 
K

Ken Snell

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.
 
K

Ken Snell

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.
 

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