setfocus to control in visible subform

D

Davo78

Hi All,

I have a from "Input" which has a subform "Variations" which is not visible.
I make it visible with a toggle button and close it with Do Cmd Close and
goto macro (the next control of form "Input") in the "AfterUpdate" of the
comments control box, this works fine but the problem that I have is that the
subform does not take focus until I mouse click on the subform, then the
focus is set to the correct control box (VariationCode).

Is there a way of setting focus to the first control box (VariationCode) in
the subform "Variations" without using the mouse.

I have tried using the goto and setfocus commands but to no use.

Thanks in Advance

Davo78
 
D

Davo78

Ling
Thank you for your prompt reply.

Please excuse my ignorance but where would I place this syntax
in the toggle click() string or elswere.

I have been compiling my DB using books and asking questions and at times
not upto speed.

Thanks Again
Davo78
 
D

Davo78

Ling

I have tried placing the syntax in the toggle click event as you suggested,
but still cannot get it to work.

below is the toggle click event is this correct.

The main form is "Input" the subform is "Variations" and the control (in
subform Variations) to have focus is "VariationsCode"

Private Sub ToggleVariations_Click()

If Me![ToggleVariations].Caption = "Variations" Then
Me![Variations].Visible = False
Me![Variations].Visible = True
Me![ToggleVariations].Caption = "Variations Close"
Else
Me![Variations].Visible = True
Me![Variations].Visible = False
Me![ToggleVariations].Caption = "Variations"
End If

Me!Variations.Form!VariationCode.SetFocus

End Sub

Thanks for the help

Davo78
 
D

Davo78

Ling,

Thankyou for your replies

I now have this working fine, but, another question if I may, is there a way
of closing this subform programmably after update then goto the next control
"ToggleTravel".

Since getting the setfocus to work I have been trying to achieve this.

Thanks again for your help
Davo
 

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