Results 1 to 5 of 5

Thread: Macros (97)

  1. #1
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macros (97)

    I have a macro which opens a message box. When in the on change event procedure in a combo box, on a form, no problems. When the macro is in the on change event procedure in a combo box, on a subform, an error message box tells me that the subform I'm looking at is not open or doesn't exist!

    Any clues?

    Graeme

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macros (97)

    You don't say what the message box should display, but if you refer to a control on the subform, you must be aware that subforms are not "opened", and are not part of the Forms collection. So if you use something like Forms!MySubForm!MyControl, this won't work. You must include the main form in the reference: Forms!MainForm!MySubForm!MyControl.

    See Forms: Refer to Form and Subform properties and controls on the Access Web for a comprehensive overview of referring to subforms and controls.

    If this is off the mark, please post back with more details on what your macro does (or should do)

  3. #3
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macros (Access 97)

    The customer form scrolls through the customer details table. On the customer form is a subform displaying a summary of each of the customer's addresses and a combo box to select the engineer associated with the address displayed. A command button on the subform closes the customer form and opens an address details form based on the address ID of the previous address summary subform.

    The macro simply opens an information message box when the engineer name associated with the address is changed using the combo box on change event procedure. This works on the address details form but not on the address summary subform.

    I hope this makes sense!

    Graeme

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macros (Access 97)

    Thanks, but what does the message box display?

  5. #5
    2 Star Lounger
    Join Date
    Sep 2007
    Location
    Chatham, Kent, England
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macros (97)

    The macro condition now includes the main form name in front of the subform name as you advised and the thing works a treat!

    Thanks <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    Graeme

Posting Permissions

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