#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2010
    Posts
    20
    Rep Power
    0

    Cascading combo box in sub form


    hello friends
    I have a sub form with four fields’ field1, field2, field3 and field4. I want to auto display corresponding data in field2 when I select field1.
    I have this in sub form

    field1 | field2|
    -------|-------|
    A | B |
    C | D |

    When I select A in field1 I want field2 to display B

    field1 | field2|
    -------|-------|
    A | B |


    I have two tables in database table1 and table2 .
    Table1 - ID, field1, field2, field3 and Table2 - ID, field1, field2, field3, field4
    I have added fields by selecting table1 using sub form wizard. I have deleted field1 and added a combo box and renamed field1 bound to field1 of table1, a text box as field2 with control source =[field1].[field2]. It displays #Name? in field1.
    Can someone tell how can I do it?

    Thanks
  2. #2
  3. Guru
    ASP Adventurer (500 - 999 posts)

    Join Date
    May 2003
    Location
    USA
    Posts
    925
    Rep Power
    81
    You can download a sample database at Bullschmidt.com - Sample Access Invoices Database and open it up and notice that on the Invoices Dialog the Invoice # combo box on the search form is based on what was entered in the Rep and Customer combo boxes above it.

    This is done by the RowSource property of the Customer combo box's SQL statement. Also the OnEnter property of the Customer combo box runs a function which requeries itself:

    ' Dim var.
    Dim ctl As Control

    ' Set var.
    Set ctl = Screen.ActiveControl

    ' Requery control.
    ctl.Requery
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

Similar Threads

  1. Another cascading combo box question
    By MoeIndustries in forum Microsoft Access Help
    Replies: 15
    Last Post: September 16th, 2011, 12:02 PM
  2. Cascading 3 Combo Boxes
    By jkoer in forum Microsoft Access Help
    Replies: 1
    Last Post: May 25th, 2011, 01:47 AM
  3. Cascading Combo Box
    By accessdanwi in forum .NET Development
    Replies: 0
    Last Post: July 30th, 2008, 03:49 PM
  4. Cascading Combo Boxes
    By alansidman in forum Microsoft Access Help
    Replies: 12
    Last Post: February 26th, 2008, 10:59 AM
  5. Cascading Combo Boxes
    By cazlj in forum Microsoft Access Help
    Replies: 1
    Last Post: November 3rd, 2005, 01:25 PM

IMN logo majestic logo threadwatch logo seochat tools logo