Results 1 to 8 of 8
  1. #1
    chittyth is offline Novice
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    3

    Creating a variable combo box within a subform

    I'm trying to create a variable combo box, using a query parameter through within an existing subform however I keep getting asked to input a Parameter Value when I follow the whole process in the parent form. And when I open the sub form on it's own the query I have created works as expected.



    The subform I am working on already has an existing variable combo box which has a parameter relying on data input from the parent form, and I have managed to create this successfully. So I'm not sure why I am getting this error when I have the data it is asking for easily available?

    Does anyone know why this is the case? I appreciate I'm being quite vague but not sure what detail I need to provide, so please don't hesitate to ask for me information.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Reference is different if in a subform?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    chittyth is offline Novice
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    3
    What should that reference be? And why would my first reference across sub form to parent form work as normal?

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    perhaps show the code you are using

  5. #5
    chittyth is offline Novice
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    3
    Do you mean share the SQL code? I've taken it below

    SELECT [Business_KPIs].[Secondary KPI], [Business_KPIs].[Primary KPI]
    FROM [Business_KPIs]
    GROUP BY [Business_KPIs].[Secondary KPI], [Business_KPIs].[Primary KPI]
    HAVING ((([Business_KPIs].[Primary KPI])=[Forms]![Business_Retailer Actions]![Primary KPI]));

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    it doesn't need the group by line unless this is to hide duplicates

    It sounds like this code is in the subform code since you say it works as a stand alone form

    if this is the case then all you need is

    ......=[Primary KPI]

    if you want or need to go the form route you need

    =forms!nameOfMainForm.nameOfSubformControl.Form.[Primary KPI]

    see this link about referencing controls not on the form

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,824
    @Ajax, link not in your post.
    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.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398

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

Similar Threads

  1. creating and updating a variable field
    By ecConnect in forum Reports
    Replies: 12
    Last Post: 02-11-2021, 03:32 PM
  2. Combo Box variable change subform
    By AutumnBeds in forum Forms
    Replies: 15
    Last Post: 11-03-2019, 09:14 AM
  3. Replies: 6
    Last Post: 11-21-2017, 03:10 PM
  4. Replies: 3
    Last Post: 05-28-2013, 12:53 PM
  5. Replies: 3
    Last Post: 01-21-2013, 12:57 AM

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