Results 1 to 7 of 7
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Right-click popup in a subform

    I have a right-click popup menu I want to "service" with a function that I'd like to have defined in the code-sheet of a "continuous" subform, " DonationSubform". Access complains that it can't find the function UNLESS I place it in the code sheet of the parent form. That would be okay except I can't seem to find out how to pass the function the record ID of the record upon which the right-click occurred. The popup "Action" expression is "=MoveDon()" and I've tried "=MoveDon([FamDonID]). The latter being the record ID of interest to the purpose of the function. With the function being defined in the parent, I've tried to reference "FamDonID" using Forms!DonationSubform.Form!FamDonID, but Access complains that it can't find the subform at the time the subform and all of its recordsource is being displayed.

    Any of this make sense?

    The whole point is to gain access to the current value of "FamDonID" at the time the popup menu is triggered.



    BTW, while created in A2000 or A2003, popup menus are supported in later versions of Access, but one can't create them beginning with ribbons in A2007.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I always give subform container control a name different from the object they hold, like ctrDonation.

    Try:

    Me.ctrDonation!FamDonID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    One of the 1st things I discovered when I opened the covers on this caper was the container name being the same as the sub-form name. A lot of references in code, so I'll fix it VERY CAREFULLY. (Probably easier to change the name of the form, but we'll see.)

    Me.DonationsSubform!FamDonID works perfectly.

    I'll go with "this" solution, but I still can't understand why the Public function isn't found when it resides in the code sheet of the sub-form.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    AFAIK, procedures behind forms are only available to those form, regardless of the 'Public' declaration, unless you prefix the procedure call with the form qualifier

    Call Forms("SampleManagement").LabReport(strLabNum, "Transfer")

    or in this case through the subform container

    If Me.tbxSet Like "*1*" Then Call Me.ctr1.Form.SaveData
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I'll play with this a bit more tomorrow. I thought with the right-click action being executed on the sub-form that the function invoked could be contained in the code sheet of the sub-form. Doesn't that satisfy what you say "Procedures behind forms are only available to those form"?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, seems to me it should work but I've never used customized right-click. I know that the intrinsic right-click recognizes value of the control where the click occurs.

    I do have code in the DblClick event of a subform.

    Perhaps the issue is that right-click is not a form event, at least it is not listed on the Properties Sheet.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I'll comment the function code in the parent so it's clear what's happening.

    I considered using the double-click event to provide the needed function, but that would create a significant inconsistency for the user, as the double-click action throughout the app imply the same functionality AND right-click popups are used consistently to present options pertaining to the current record in continuous forms.

    Thanks,
    Bill

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-21-2013, 10:07 AM
  2. Right-Click popup - Function not found???
    By GraeagleBill in forum Programming
    Replies: 9
    Last Post: 04-01-2013, 12:45 AM
  3. Replies: 1
    Last Post: 02-21-2013, 12:27 PM
  4. Subform ControlSource Popup issue
    By GraemeG in forum Forms
    Replies: 10
    Last Post: 04-07-2011, 11:52 AM
  5. Form-Subform-Popup Problem
    By TrudyD1474 in forum Forms
    Replies: 1
    Last Post: 06-10-2010, 05:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums