Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    London
    Posts
    87

    Unanswered: Custom shortcut menus and referencing subforms?

    have a custom shortcut menu bar for certan controls and one of the buttons calls the "SetBalance" function, that updates the current record to a calculated value based on the value of other fields in the form.

    This works fine on normal forms where I just include a function with that name in the Form module. However when the relevant control is in a subform, the routine ins't found and if I ahve the code in the parent form, I can't reference the controls in the subform.

    Any suggestions?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    looks like your function is out of scope: a subform does not have "natural" access to routines in it's parent form.

    if your parent form routine is declared
    Private Function blah blah

    try changing to
    Public Function blah blah

    if this is really a routine used in multiple forms (which you sort-of suggest in your post) stick it in a global module as Public so all your forms can access the same code.

    izy

  3. #3
    Join Date
    May 2002
    Location
    London
    Posts
    87
    Solved.

    The code for referencing controls on a subform is:

    Me!ctlSubForm.Form.ActiveControl

    or

    Me!ctlSubForm.Form!txtControlOnSubForm

Posting Permissions

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