Results 1 to 10 of 10
  1. #1
    Office10 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    7

    Dependent combo box in Web Database

    Hello,



    See the Main form of attached file, I would like to see contacts list box is made from drop-down list Customers. dependent

    In the main form needs to select one customer, only the contacts 'de Vries' and 'Van der Linden' can be selected in the combo box of contact (in the main form) ..
    I do not succeed despite several attempts with macros to achieve this.

    Anyone have an idea how to solve this. Preferably modify the file so that I see the solution.

    Thanks in advance.Example11.zip

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Contact combobox RowSource: SELECT cntName, CompanyName FROM Contacts WHERE CompanyName=[Keuzelijst0];

    Then must requery the contact combobox after customer selected. Use AfterUpdate macro of customer combobox.

    This is so simple with non-web db. However, this is insisting the reference to customer combobox in the RowSource be a parameter declared with Query Parameters dialog. I've never done this. Do you know where to go from here?
    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
    Office10 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    7
    I did what you said, but I get a message that something is not going well with [Keuzelijst0] and query parameters, see Attachement. Do you know what this is? Maybe I forgot some statement?
    Example11.zip

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    I've never built web database nor used Query Parameters dialog.

    As far as I can tell, the actual value of CompanyName field in Contacts is the ID from Customers because of Lookup, not the company name. This means the Customer combobox properties should be:

    RowSource: SELECT ID, custName FROM Customers;
    ColumnCount: 2
    ColumnWidths: 0";1.5"

    I found the Query Parameters dialog. It is available when a query is open in design view. I opened the contact combobox in design view and don't see any query parameters. I tried setting one but it doesn't offer Integer data type. Review this thread on the same issue https://www.accessforums.net/access/...xes-40936.html
    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.

  5. #5
    Office10 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    7
    Have been attached an easier example. I build this example according to the site:

    http://social.msdn.microsoft.com/For...orum=accessdev

    It is intended that when selecting Edmonton City in cboCity the, City Edmonton in cboStores can be chosen, and not city Vancouver.

    Unfortunately this does not work. Possibly you can specify how this file works (see attachement).. So that I can apply it to my previous file.Easier Example11.zip

    Please change the file and upload as Zip/RAR so that I not misunderstand what you mean.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Your TempVars variable is referencing wrong combobox. Should be cboCity.

    There is no Lookup setting for the City field in tblStores so it is saving the actual name, not ID. Change cboCity properties to:
    RowSource: SELECT City FROM tblCity;
    ColumnCount: 1
    ColumnWidths: 1

    Change the RowSource for cboStores to:
    SELECT tblStores.ID, tblStores.Store, tblStores.Address FROM tblStores WHERE (((tblStores.City)=[TempVars]![strCity]));

    If you want to see the store address in the combobox list, change:
    ColumnCount: 3
    ColumnWidths: 0";0.5",1.0"
    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.

  7. #7
    Office10 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    7
    Easier Example11.zip


    I made the changes, see attachement but it still does not work...

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    Didn't make all the suggested edits. The embedded macro for cboCity still references the wrong combobox for setting the TempVars variable. Change it to cboCity.

    Then you went and set lookup for City field in tblStores so now cboCity RowSource must include the ID field and fix ColumnCount and ColumnWidth properties.

    Works perfectly.
    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.

  9. #9
    Office10 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    7
    Thanks, largely works now, I only see now a number below City column instead of the cityname at cboStores (combobox field in the form). How can I make sure that the name of the city comes to stand under column City in cbo Stores? See also attachement

    Easier Example111.zip

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,644
    cboStores properties:

    RowSource: SELECT tblStores.ID, tblStores.Store, tblStores.Address FROM tblStores WHERE (((tblStores.City)=[TempVars]![strCity]));

    ColumnCount: 3

    ColumnWidths: 0";0.3938";0.3938"
    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.

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

Similar Threads

  1. dependent combo boxes
    By jle0003 in forum Forms
    Replies: 3
    Last Post: 10-03-2012, 02:23 PM
  2. Dependent Combo Boxes
    By schwabe in forum Forms
    Replies: 3
    Last Post: 01-09-2012, 04:33 PM
  3. Year Dependent on Combo Box
    By hawkins in forum Access
    Replies: 7
    Last Post: 08-12-2011, 04:15 PM
  4. Dependent Combo Box
    By tigers in forum Forms
    Replies: 1
    Last Post: 06-16-2009, 12:46 PM
  5. Replies: 3
    Last Post: 02-26-2009, 10:17 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