none
manager RRS feed

  • Question

  • I am trying to set focus from a sub form to a sub form with the click event and or the key down event.  I can change the value but of the txt box but I cannot get it to receive the focus. If I click in the form it works and perfectly. I check the Activecontrol.name and it shows the control I clicked in not the one I set focus to. All the reference material I have does not give me conditions the would stop the setfocus both the form and the textbox are enabled , both show as visible.  

    Private Sub SuFormItemNumber_Click()
    On Error GoTo err1

    count1 = 1
    Forms!main!FmInvoiceBody!ItemNumber.Value = Me!SuFormItemNumber
    Forms!main!FmInvoiceBody!txtcount1.SetFocus
    Forms!main!FmInvoiceBody!txtcount1.Value = 1
    Exit Sub
    err1:
    MsgBox Err.Number & ": " & Err.Description
     Resume Next

     
    Tuesday, August 22, 2017 6:05 PM

All replies

  • Hi,

    If you're trying to move the focus from a subform to another subform, try setting the focus to the subform control first. For example:

    Me.Parent.OtherSubform.SetFocus

    Me.Parent.OtherSubform.Form!ControlName.SetFocus

    Hope it helps...

    Tuesday, August 22, 2017 6:12 PM
  • Hi Jim imo,

    your description is little confusing.

    do you mean , first you set the focus of textbox in one sub form and set the value.

    then after , you click on other sub form and still you want to keep the focus on the textbox from first sub form?

    I understand that , if you click manually then it will work correctly for that sub form.

    or there is a button in one sub form. and you are trying to click that button and trying to set focus of the textbox resides in other sub form?

    I also want to confirm with you that what is the purpose of setting focus?

    also if possible then provide the picture of your form and proper steps to reproduce the issue.

    then we can provide more solid reply to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, August 23, 2017 1:17 AM
    Moderator
  • Hi Jim imo,

    I can see that , after creating this thread, you did not follow up this thread.

    is your issue is solved now?

    if yes , try to post the solution and mark it as an answer.

    if your issue is still exist then try to refer the suggestions given by the community members.

    if you think that the suggestion given by the community member can solve your issue then mark that suggestion as an answer.

    if you have further questions regarding the same issue then let us know about that.

    we will try to provide further suggestions to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 5, 2017 6:20 AM
    Moderator