[AccessD] Referring to a control on a subform

Shamil Salakhetdinov shamil at users.mns.ru
Sun Sep 4 12:18:21 CDT 2005


> a) set focus to a control on the subform
Are you talking run- or design- time?
Run-time:

1. set focus to form using form's .SetFocus method
2. set focus to first parent subform's control using subform control's
.SetFocus method
[3. set focus to the second(nested) parent subform's control (if any) using
nested subform control's .SetFocus method]
4. set focus to control using control's .SetFocus method

Wtih Me
   .SetFocus ' no need if form has focus
  .subformControlName.SetFocus
  ..subformControlName.Form.ControlName.SetFocus
end With

Design-time: I don't know.(It should be possible to do that using WinAPI or
I guess there could be undocumented feature, which I don't know about).

> b) call a procedure in the subform's module...
Yes, it should be public (exception is when it's a function/sub implementing
object interface).
Syntax:

With Me
     .subformControlName.Form.MethodName...
End With

> c) set a control's value in the subform to a specified value. Is it
With Me
     .subformControlName.Form.ControlName.Value = 12345
End With

When you write .subformName do you mean subform's control name or ... ?

HTH,
Shamil

----- Original Message ----- 
From: "Arthur Fuller" <artful at rogers.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Sunday, September 04, 2005 8:20 PM
Subject: [AccessD] Referring to a control on a subform


> It seems I cannot recall how you refer to a control on a subform. I want
to
> do a couple of different things. In each case, assume that the code is in
> the parent form's module.
> a) set focus to a control on the subform
> With Me
>     .subformName.Form.ControlName.SetFocus  'is this how?
> End With
> b) call a procedure in the subform's module... I assume I have to change
it
> from a Private to a Public sub, but what syntax do I use to call the sub
> from outside? Is it
> With Me
>     Call .subformName.ProcedureName
> End With
> c) set a control's value in the subform to a specified value. Is it
> With Me
>     .subformName.Form.ControlName = 12345
> End With
>
> TIA,
> Arthur
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list