Results 1 to 5 of 5
  1. #1
    jaymin is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jan 2012
    Location
    gold coast Australia
    Posts
    57

    Wink three cascading combo boxes to enter data to a subform

    Hope some canhelp me, i have read many cascading threads and tutorials and videos on thesubject and still it does not work,
    My scenario isthat I have a form named “frmMain” on it has three cascading combo boxes, thefirst named “cboStation”, the second “cboStaff” and the third is “cboPPE” and a sub form called subfrmMaint to enter therequired data
    tblStation
    pk IDStation
    stationName

    tblStaff
    pk IDStaff
    firstName
    surname
    Fk IDStation

    tblPPE
    Pk IDPPE
    chipNumber
    fk IDStaff
    fk IDMaint

    tblMaintenance
    pk IDMaint
    Date
    afterUse
    repairs
    fk IDPPE



    first I use the cboStation to filter the names for the cboStaff then thatis used to filter the chip number for the cboPPE, which is then used to filtera subform so I can enter details into the it, called subfrmMaint.
    When ever I open the cboStaff I keep getting a form appearing with “Forms!frmMain!cboStation”requesting me to enter something so it can filter combo box but ends up blank.
    In the row source field for cboStaff :-
    SELECT tblStaff.IDStaff, tblStaff.FirstName FROM tblStaff WHERE(((tblStaff.IDStation)=forms!frmMain!cboStati on)) GROUP BY tblStaff.IDStaff,tblStaff.FirstName;
    This has confused me, I have spent many hours on this to no avail, hopesome can help please.

    Peter

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Double check the spelling of the form and combo names (and that you have the name of the combo, not the label). If the combo is actually on the subform, the syntax changes:

    Forms Refer to Form and Subform properties and controls

    If you're still stuck, can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jaymin is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jan 2012
    Location
    gold coast Australia
    Posts
    57
    Pbaldy,
    Thanks for you reply, I have found what is going on but donot why or how to fix it hope you can help.
    I created two cascading combo boxes, one for “StationName”, “cboStation”the other for “Staff”, “cboStaff” and with txt boxes bounded to them, when I entereddata into “cboStation” the first txt box gets data in it, when I open the “cboStaff”it is filtered by the “cboStation” and the second txt has data in it, all seemsok except
    Click image for larger version. 

Name:	combo good.jpg 
Views:	30 
Size:	13.9 KB 
ID:	7822
    the second combo box is not been requeried yet.

    When I add the requery function in to the “after update”event

    Option Compare Database
    Private Sub cboStation_AfterUpdate()
    Me.cboStaff.Requery
    End Sub

    It causes the form not to work, looks like this, and the txtboxes loose their focus, although the “control source” is =[cboStation] isstill the same, and the “cboStaff” when selected causes the form “EnterParameter Value” to open.
    Click image for larger version. 

Name:	combo bad.jpg 
Views:	30 
Size:	18.8 KB 
ID:	7823
    I
    can delete the combo, txt boxes and the VBA code “requery”and start again on the same form but it still will not work, the problem staysthe same, but if I create a new form I can get to work up to the “requery”, wherethe problem starts over again.


    Peter

  4. #4
    jaymin is offline Advanced Beginner
    Windows Vista Access 2003
    Join Date
    Jan 2012
    Location
    gold coast Australia
    Posts
    57
    pbaldy,
    Thank you for your help, I have found out the problem, my version of access must have been corrupted, i ran a repair on it and now all seems to work.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it sorted out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 01-22-2012, 10:48 PM
  2. cascading combo boxes in continuous subform
    By ayamali in forum Programming
    Replies: 1
    Last Post: 03-29-2011, 06:33 PM
  3. Cascading combo boxes
    By combine21 in forum Forms
    Replies: 3
    Last Post: 12-02-2010, 12:57 PM
  4. Cascading Combo Boxes
    By desireemm1 in forum Programming
    Replies: 1
    Last Post: 10-05-2009, 06:00 AM
  5. Cascading Combo Boxes
    By gjw1012 in forum Access
    Replies: 1
    Last Post: 07-25-2009, 04:59 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