Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013

    Unanswered: cascade combo boxes

    Hi, Im new here, and I was wondering if this sound logical to you guys.

    Im creating a DB to store employees. I have a tblEmpleados with the employees info. Another table called tblDepartamentos to store de Departmens that employee belongs to. And another table, tblAreas where is stored the area of that department that the employee belongs to. On the form I have a lookup cbo that tells me all the departments, and another combo that show only the areas for that department. And that works fine. Now the thing is that I want to set the cboareas.enable=false when there is no area for that department. Example

    Mr. Perez works at the Academic Department in the Area of Registry. (Everything fine here)

    mr. Smith work at the Maintanence Department wich have no areas. (here when the user select Maintenence Dept, the cboAreas, should not be enable)...

    Does that make any sense??? besides that is working perfectly

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    In the AfterUpdate event of the cboDepartments use something like this:
    Private Sub cboDepartments_AfterUpdate()
     Select Case cboDepartments
      Case "Maintenance", "Some other Department with no areas"
       cboAreas.Enabled = False
      Case Else
       'Code for cascading to cboAreas if there are areas for the given Department goes here
     End Select
    End Sub

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Feb 2013
    thanx for the reply. That sounds great, but that limit the DB, in case some other year, lets say that department do have some areas... the select case wil not work.

    I kinda force the code and is doing it now. When i click another textbox, it checks to see if the value in area is null if it is, then it disable the dropbox. Is kind of hard-forced code but is working


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts