Results 1 to 13 of 13
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Cascading Combo boxes Problem

    i have created 2 combo boxes based on the following videos

    http://www.datapigtechnologies.com/f...combobox1.html
    http://www.datapigtechnologies.com/f...combobox2.html

    but they are not solving the problem

    i have a main form and a sub form (Admin Purchase) and a subform (Admin Purchase subform)

    these combo boxes are placed on Admin Purchase subform

    code as follows:

    SELECT Items.[Item Description]
    FROM Items
    WHERE (((Items.[Purchased From Company])=[forms]![Admin Purchase Subform].[cbocomp]))
    GROUP BY Items.[Item Description]

    In after update code:

    Private Sub Description_AfterUpdate()
    Me.Requery


    End Sub


    I am having following problems:
    1. when i try to run it from (Admin Purchase) which is the Main form, it gives error.
    2. If I run it from (Admin Purchase subform) it works only one time If i change the value in cbocomp nothing changes.

    pls help me fix this problem.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  3. #3
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    Hi Orange

    I have tried everything possible, even went through the web link provided by you again and again. But I could not fix the problem.

    when I use the cascade combo boxes on subform they work fine. But when used on the mainform they are giving error.

    can you please take a look at the sample I have attached and guide me what mistake am I doing.

    Problematic combo boxes are in Red Color in the sample DB.

    Unfortunately there is some problem on this website that I cannot upload the Sample DB therefore am uploading it to a different site. please dowload it from
    http://rapidshare.com/files/455589566/Sample_DB.zip

    thank you

    regards
    aamer

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See if this link helps: http://www.mvps.org/access/forms/frm0031.htm
    The syntax is different when referencing SubForms than referencing Forms.

  5. #5
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    I could not figureout which property to use from this link.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If you are referencing a control on a SubForm then this is the syntax:
    FORMS.SubFormControlName.FORM.ControlName
    ...using your values of course.

  7. #7
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    this is exactly what I have done but some how its not working, I dont know where i am doing a mistake. If you had seen the sample I have made then you would have not said this.
    If you can kindly have a look at the sample link:
    http://rapidshare.com/files/455589566/Sample_DB.zip
    and point me in the right direction.

    Thax for your help

    PS: unfortunately the uploading on www.accessforums.net is not working, thats why I have placed the file on rapidshare.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    This is *not* what you did in post #1.

  9. #9
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    yes you are right.
    I changed it according to orange's link http://www.baldyweb.com/CascadingCombo.htm

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I did not spell it out correctly in my Post #6. It overlooked the MainForm in the syntax. It should have been:
    FORMS.MainFormName.SubFormControlName.FORM.ControlName
    In your case the SubFormControl in not named the same as the SubForm it displays (which is a good thing BTW). The actual line for your control so it works in the SubForm is:
    SELECT [Item Description] FROM Items WHERE (((PurchasedFrmCompany)=Forms.[Admin Purchase].[Company Subform].FORM.cbopurfrm)) ORDER BY [Item Description];
    Last edited by RuralGuy; 04-02-2011 at 08:33 PM. Reason: Unsuccussfully tried adding uploaded file.

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Here's the modified file. The upload is now working.

  12. #12
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276
    thank you. I now understand the mistake I was doing.
    1 Question. is there a specific reason that you placed a text box on main form with the value
    =[Company Subform].Form!cbopurfrm

    can u eleborate please.

    Thank you so much for your guidence.

    Regards
    aamer

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Just zeroing in on the proper syntax. I forgot I put it there. If you are satisfied with the solution, go ahead and use the Thread Tools and mark this thread as Solved.

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

Similar Threads

  1. Cascading combo boxes
    By Jackie in forum Access
    Replies: 5
    Last Post: 07-26-2013, 09:07 AM
  2. Cascading combo boxes
    By combine21 in forum Forms
    Replies: 3
    Last Post: 12-02-2010, 12:57 PM
  3. Cascading Combo Boxes
    By desireemm1 in forum Programming
    Replies: 1
    Last Post: 10-05-2009, 06:00 AM
  4. Cascading Combo Boxes
    By gjw1012 in forum Access
    Replies: 1
    Last Post: 07-25-2009, 04:59 PM
  5. Problem with Cascading Combo Boxes
    By CushingMT in forum Forms
    Replies: 0
    Last Post: 11-13-2008, 09:44 AM

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