Results 1 to 5 of 5
  1. #1
    dbalilti is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    53

    Help Plz. Creating cascading comboBoxes then form crashes

    Hi everyone,

    So I am creating a new database with four tables.

    I want to create a simple form which allows the user to go through the four hierarchies in order to display some data.

    I am using 4 or 5 combo boxes in a cascading fashion in order to filter through the database.

    combo boxes work correctly and the data starts to populate as i get more and more detailed with the combo boxes, but if I go back up to the combo boxes before the form usually crashes!

    I will give an explain

    I go from combo box 1-->2-->3-->4 then back up to 2-->3 (crash). I can change 2 but once i get to 3 and change it, the form crashes.!



    Please help me! Tell me what other information you might need.

    Main form: http://s23.postimg.org/qt8pxqim3/main_form.jpg
    Table Relationship:http://s8.postimg.org/xcardyxj9/table_relationships.jpg

    Here is my Visual Basics code.
    Code:
    Option Compare Database
    
    Private Sub asset_AfterUpdate()
    
    Me.description.Requery
    Me.Requery
    Me.a.Visible = True
    Me.b.Visible = True
    Me.c.Visible = True
    Me.d.Visible = True
    Me.e.Visible = True
    Me.f.Visible = True
    Me.g.Visible = True
    Me.h.Visible = True
    Me.i.Visible = True
    Me.j.Visible = True
    Me.k.Visible = True
    Me.l.Visible = True
    Me.m.Visible = True
    Me.a.Visible = True
    Me.n.Visible = True
    Me.o.Visible = True
    Me.p.Visible = True
    Me.q.Visible = True
    Me.r.Visible = True
    Me.s.Visible = True
    Me.t.Visible = True
    Me.u.Visible = True
    Me.v.Visible = True
    Me.w.Visible = True
    Me.x.Visible = True
    Me.y.Visible = True
    Me.z.Visible = True
    End Sub
    
    Private Sub classification_AfterUpdate()
    Me.facility.Requery
    Me.Requery
    End Sub
    
    Private Sub description_AfterUpdate()
    Me.Requery
    End Sub
    
    Private Sub facility_AfterUpdate()
    Me.address.Visible = True
    Me.c_year.Visible = True
    Me.r_value.Visible = True
    Me.City.Visible = True
    Me.m_unit.Visible = True
    Me.o_condition.Visible = True
    Me.a_catagory.Visible = True
    
    Me.Asset.Requery
    Me.Requery
    
    End Sub
    Private Sub Form_Load()
    Me.address.Visible = False
    Me.c_year.Visible = False
    Me.r_value.Visible = False
    Me.City.Visible = False
    Me.m_unit.Visible = False
    Me.o_condition.Visible = False
    Me.a_catagory.Visible = False
    Me.a.Visible = False
    Me.b.Visible = False
    Me.c.Visible = False
    Me.d.Visible = False
    Me.e.Visible = False
    Me.f.Visible = False
    Me.g.Visible = False
    Me.h.Visible = False
    Me.i.Visible = False
    Me.j.Visible = False
    Me.k.Visible = False
    Me.l.Visible = False
    Me.m.Visible = False
    Me.a.Visible = False
    Me.n.Visible = False
    Me.o.Visible = False
    Me.p.Visible = False
    Me.q.Visible = False
    Me.r.Visible = False
    Me.s.Visible = False
    Me.t.Visible = False
    Me.u.Visible = False
    Me.v.Visible = False
    Me.w.Visible = False
    Me.x.Visible = False
    Me.y.Visible = False
    Me.z.Visible = False
    End Sub

    Note, the combo boxes cascade from classification-->facility-->asset-->description
    Attached Thumbnails Attached Thumbnails main_form.jpg  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    dbalilti is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    53
    I will provide a database for analysis as soon as I remove confidential data. Unfortunetly, there is alot of data

  4. #4
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    The first thing I'd check - when the user changes the higher-level combo box, are you properly clearing the values of all the dependent combo boxes? Have you set the order of the AfterUpdate operations so that you don't get an infinite requery?


    for instance, in the cboClassification_AfterUpdate, do these in this order

    Me.cboAsset = Null
    Me.cboFacility = Null
    Me.Requery

    Then in cboFacility_AfterUpdate, you can test for the NULL and not do a requery unless you have actual data, thus avoiding an infinite loop.

  5. #5
    dbalilti is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    53
    Perfect.

    Once I did this, Alot of my crashing stopped. I also removed any uneccesary requeries & so far everything looks good. No crashing..

    Thank you

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Trouble with Cascading ComboBoxes
    By shane201980 in forum Programming
    Replies: 3
    Last Post: 10-03-2012, 09:05 AM
  2. Replies: 9
    Last Post: 08-07-2012, 11:50 AM
  3. Cascading ComboBoxes
    By GAccess in forum Forms
    Replies: 1
    Last Post: 03-06-2012, 05:02 AM
  4. Symmetric Cascading Comboboxes
    By schwabe in forum Forms
    Replies: 15
    Last Post: 02-02-2012, 11:38 AM
  5. Cascading Comboboxes and Sub Forms
    By PaulCW in forum Forms
    Replies: 6
    Last Post: 10-07-2011, 12:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums