Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2005
    Posts
    61

    Unanswered: how do I set focus back to the parent form?

    Hello to all,

    Ok I created my first form with a sub form on it which is set to a seperate table showing only a few of the fields on that table. What I'm wanting to having it do is that when i click on a record in the sub form which is set to datasheet it identifies which record you clicked on. This I have completed but the problem I'm having is copying certain data from that table to fields on the parent form. This is an example of something I use to copy a variable to a field.

    Forms![Circle Of Life].SR_Number_Text.SetFocus
    Forms![Circle Of Life].SR_Number_Text.text = variable

    But because this is on the parent form well it doesn't work. how do i address this as the parent form?

    Thank you for all your help.
    Mythos

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I am assuming the code is in the subform, and if so use:

    Me.Parent.SR_Number_Text.SetFocus
    Me.Parent.SR_Number_Text.text = variable

  3. #3
    Join Date
    Apr 2005
    Posts
    61

    Thank you. Now how do I take it a step further?

    This worked great. Thank you. Now how do I reference the parent from a function in a module? I don't want to have to copy the code to every field in the sub form I would rather put a call to a function in a module. and just have the code once in the module.

    Again thanks for the help.

    Mythos

  4. #4
    Join Date
    Apr 2005
    Posts
    61
    Figured it out

    Forms![Circle Of Life].SR_Number_Text.SetFocus

    what I originally did works if I put it in a module otherwise I need to do what DCKunkle gave if I'm making the call from within the sub form.

    Thanks again for all the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •