Results 1 to 3 of 3

Thread: 2 list boxes and sql and access **RESOLVED**

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Posts
    45

    2 list boxes and sql and access **RESOLVED**

    EDIT: Answer found, just use this code.

    Code:
    Dim strSQL As String
    Dim selectedLstChildCompanies As String
    selectedLstChildCompanies = CStr(LstParentCompanies)
    strSQL = "select Name from CUSTOMER_INFO where Parent_Company = " + selectedLstChildCompanies
    lstChildCompanies.RowSource = strSQL







    Greets,

    It s been awhile since I programmed, so I am pulling a blank here.

    2 tables. We ll call them table PARENT_COMPANY and table CUSTOMER_INFO.

    PARENT_COMPANY has ID (autonum) and Parent_Company_Name .

    CUSTOMER_INFO has Name and Parent_Company(number). Parent_Company is a foreign key of the table PARENT_COMPANY.

    Ok, now.

    2 list boxes, each with a table.

    The user clicks the first, selects a Parent_Company_Name. I can do that.

    Next the 2nd list box is populated with all of the possible Names from Customer_Info (Parent_company has multiples customers). Obviously, they are linked between PARENT_COMPANY.ID and CUSTOMER_INFO.Parent_Company.

    I am doing this from within a form within access 97. So all the info I found online involved openning, connecting etc to a DB which muttled me up since I am already in the DB. I remeber there was a way to do something like this utilizing subforms and child paret type things.

    But at this point I would do it in pure VBA.

    Thoughts?
    Last edited by IwishIcouldprog; Jun 4th, 2004 at 08:50 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
  •  



Click Here to Expand Forum to Full Width