Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:03:53+00:00 2026-06-09T17:03:53+00:00

I am working on an application that should allow user select a code from

  • 0

I am working on an application that should allow user select a code from a list box, and this value should be passed as a parameter to a sub-form(continuous) which is tied to an SQL Query to populate the form with values returned from the query.

How do I tie the listbox on the parent form to the continuous form (child form) in such a way that a change in the listbox is registered in the subform and it(child form) is re-populated accordingly?

The code below is what I currently have in my Parent form to trigger the change in the subform. But I am still missing the bit where I trigger the reloading of the information in the subform with this.

storedproc

SELECT tblACCOUNT.ACCOUNT_LABEL, tblACCOUNTValue.[ACCOUNTVALUE_VALUE]
FROM ((tblUPS INNER JOIN tblProductUPS ON tblProductUPS.[PRODUCTUPS_UPS] = tblUPS.[UPS_CODE]) INNER JOIN tblACCOUNT ON tblUPS.UPS_ID = tblACCOUNT.ACCOUNT_UPSID) INNER JOIN tblACCOUNTValue ON tblACCOUNTVALUE.[ACCOUNTVALUE_ACCOUNTID]= tblACCOUNT.[ACCOUNT_ID]
WHERE TBLPRODUCTUPS.[PRODUCTUPS_PRODUCTID] =   (SELECT tblProductLevel.[PRODUCTLEVEL_ID] 

FROM  tblProductLevel WHERE tblProductLevel.[PRODUCTLEVEL_Code] IN ( [UPSIDS])

   );

This is a field in my sub-form which I would like to tie to my query as source of parameter for the query.

Public Property Let qString(unstring As String)
    If Not IsNull(unstring) And Len(unstring) > 0 Then
            Currentstring = unstring
    End If
End Property

The code below is code in my parent form I test connects directly to the Query that I created and passes the parameter directly to the query. However, since my sub-form is itself tied to the query, I need a way to get to the subform query and pass the information I need passed and invoke an update on the form afterwards.

  Private Sub LoadSubform(unspscstring As String)
On Error GoTo Err_LoadSubform_Change

            Dim dbs As Database
            Dim strSQL As String
            Dim strSelect  As String
            Dim strQueryName As String
            Dim qryDef As QueryDef
             Dim rst As Recordset
             Dim prmOne As DAO.Parameter

            Set dbs = CurrentDb
            'then we'll open up the query:
            Set qryDef = dbs.QueryDefs("spgetAttributeByUNSPSC")
            'Now we'll assign values to the query using the parameters option:
                'link your DAP.Parameters to the query
                'Set prmOne = qryDef.Parameters!param_one
                'prmOne = unspscstring
             qryDef.Parameters(0) = unspscstring
             'Now need to somehow trigger an update on the subform

            'Close all objects
            rst.Close
            qryDef.Close
            Set rst = Nothing
            Set qryDef = Nothing
Bye_LoadSubform_Change:
                     Exit Sub

Err_LoadSubform_Change:
Beep:                      MsgBox Error$, 16, "Select Failed"
                     Resume Bye_LoadSubform_Change

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:03:55+00:00Added an answer on June 9, 2026 at 5:03 pm

    As long as the listbox allows only one item, you can use the link child and master fields of the subform to do this.

    Link Child Fields: ID; ListFieldMatch
    Link Master Fields : ID; MyListBox
    

    Alternatively, you can set the Record Source of the form object of the subform control in VBA:

    sSQL = "SELECT ID,Stuff FROM Table WHERE ID=" & Me.MyNumericListBox
    Me.MySubformControlName.Form.RecordSource = sSQL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on an iOS application that I allow the user to
I'm working on an application that contains some buttons defined via layout.xml like this
Im working on a simple task manager that would allow user to kill running
I am working on a c# application that is serially encrypted when user install
I am working on an application that will allow users to create queries on
Suppose I am working on an application that allows any user to create quizzes
I am working on splitting out an existing, working application that I currently have
Im working on an application that needs to talk to a database. The application
I'm working on an application that needs to convert an HTML workspace (fixed size
I'm working on an application that integrates w/ Facebook to publish videos that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.