Hi -
Is it possible (given that I am in a subform) to use VBA to set focus to a
command button on the form (that contains the subform)?
Thank you for your help,
Joy
RuralGuy - 31 Oct 2005 20:25 GMT
Certainly! Me.Parent.cmdButtonName.SetFocus
Using your cmbButtonName of course.
>Hi -
>
[quoted text clipped - 4 lines]
>
>Joy
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Ofer - 31 Oct 2005 20:51 GMT
And please ignore the buttom part of my post, its not relevant to you

Signature
This one - >
(If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.)
Good luck
> Hi -
>
[quoted text clipped - 4 lines]
>
> Joy
Ofer - 31 Oct 2005 20:51 GMT
Try
Me.Parent.[CommandButtonname].SetFocus
Or
Forms![MainFormName]![CommandButtonname]

Signature
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.
Good luck
> Hi -
>
[quoted text clipped - 4 lines]
>
> Joy
Ofer - 31 Oct 2005 20:57 GMT
I missed the setfocus in the second option
Forms![MainFormName]![CommandButtonname].Setfocus

Signature
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.
Good luck
> Hi -
>
[quoted text clipped - 4 lines]
>
> Joy
Joy M - 01 Nov 2005 00:05 GMT
Hi -
Thanks for your quick responses. They worked fine.
I was using a period instead of an exclamation mark in mine.
I.e., I had Forms.[MainFormName].[CommandButtonname].Setfocus but it didn't
work
How do you decide when to use ! and when to use a period in this syntax?
Thanks again,
Joy