need help with cascading combo/list boxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pouj
    New Member
    • Aug 2007
    • 18

    #16
    i did all that as you said..but once again..is being the same...would it be possble if i send you the file so you look at it?

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #17
      I can't open your file, it says unrecognized database format.

      Just answer these two questions and I should be able to fix the problem.

      I also need to know the values for "and i put in all the control source and row source and column count a you stated"

      I also need to know what the form is bound to, if anything, and the fields of that table if different from the two you have described.

      Comment

      • pouj
        New Member
        • Aug 2007
        • 18

        #18
        is probaly cause is access 2007

        okay
        here is the information...
        for cpyname
        name: cpyname
        controlsource: cpyname
        colum count: 2
        colum width: 1
        rowsource: tblcompany
        rowsource type: table/query
        bound colum: 2

        for empname
        name: empname
        controlsource: empname
        colum count: 1
        colum width: N/A
        rowsource:
        rowsource type: table/query
        bound colum: 2

        i will try sending you the db in access 97-2003 format

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #19
          1) Your form's record source uses a join. Joins are not updateable. As your form is setup now, there's no need for the form at all. The whole purpose of having the 2 lookup tables and cascading combo boxes is to populate the fields of a third table. Not to populate themselves.

          2) The settings should be
          name: cpyname (This should probably be CompanyID)
          controlsource: (Whatever field you want to save this to, a third table, not your lookup tables, that defeats the purpose of cascading combo boxes)
          colum count: 2
          colum width: 0
          rowsource: tblcompany
          rowsource type: table/query
          bound colum: 1

          name: empname (This should probably be EmployeeID)
          controlsource: (See Above)
          colum count: 2
          colum width: 0
          rowsource:
          rowsource type: table/query
          bound colum: 1

          3) The Code
          Code:
          Private Sub cpyname_AfterUpdate()
             With Me![empname]
                If IsNull(Me!cpyname) Then
                   .RowSource = ""
                Else
                   .RowSource = "select id, [empname] " & _
                   "from tblemployees " & _
                   "where [id] =" & Me!cpyname
                End If
                Call .Requery
             End With
          End Sub

          Comment

          • pouj
            New Member
            • Aug 2007
            • 18

            #20
            hey
            i just did all that..but now it doesnt requery.....lik e when i choose company nothing happens in employee....wha ts the suggestion?

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #21
              What's the record source of your form. Delete whatever's in the record source property of the form.

              Comment

              • pouj
                New Member
                • Aug 2007
                • 18

                #22
                i did that..and that didnt do any good! still same thing...it shows nothing in employee list.

                Comment

                • Rabbit
                  Recognized Expert MVP
                  • Jan 2007
                  • 12517

                  #23
                  Delete whatever's in the control sources from both combo boxes.

                  Comment

                  • pouj
                    New Member
                    • Aug 2007
                    • 18

                    #24
                    did that, no work...

                    Comment

                    • Rabbit
                      Recognized Expert MVP
                      • Jan 2007
                      • 12517

                      #25
                      I don't know what you could be doing wrong, send it to me again. I was able to get it working.

                      Comment

                      • pouj
                        New Member
                        • Aug 2007
                        • 18

                        #26
                        okay i finally got your tutorial to work.
                        okay but now...this is what i am want to do for school project.

                        I have to set up this cascadog combo/list boxs
                        basically
                        they way you would say it english would be like this

                        if value in combobox1 is Available (combo box choices are available, on project, vacatio)
                        then search the table1 for anyone with Available status and list them in combobox.

                        thats how it should be done....if not possible what is my choice.

                        Comment

                        • Rabbit
                          Recognized Expert MVP
                          • Jan 2007
                          • 12517

                          #27
                          Originally posted by pouj
                          okay i finally got your tutorial to work.
                          okay but now...this is what i am want to do for school project.

                          I have to set up this cascadog combo/list boxs
                          basically
                          they way you would say it english would be like this

                          if value in combobox1 is Available (combo box choices are available, on project, vacatio)
                          then search the table1 for anyone with Available status and list them in combobox.

                          thats how it should be done....if not possible what is my choice.
                          You can do this with the cascading combo boxes. The first combo box holds the status values. The second combo box's row source is changed accordingly in the after update event of the first combo box. It's no different than a cascading combo box save for the exact syntax you use. But the concept is the same.

                          Comment

                          Working...