Results 1 to 13 of 13
  1. #1
    jamal numan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Ramallah, West Bank
    Posts
    113

    Question (Again) dependent fields,


    (Again) dependent fields,

    In the attached screenshot, I wanted to choose the values of the fields of the table from other two tables

    I applied the combo box tool to read the values of the first field from a list but couldn’t know how to achieve the following:


    1. If the value A is chosen in the field T07_F1, then the values on the T07_F2 should be A1, A2 or A3



    1. If the value B is chosen in the field T07_F1, then the values on the T07_F2 should be B1, B2 or B3



    1. If the value C is chosen in the field T07_F1, then the values on the T07_F2 should be C1, C2 or C3



    The mdb file is attached

    And so forth.

    Which code might achieve this sort of things?

    Thank you for the help,

    Best

    Jamal
    Attached Thumbnails Attached Thumbnails Clip_202.jpg  
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    You are saving the numeric ID values in T07, not the alpha characters. This actually complicates. Dependent comboboxes with 'lookup' RowSource in Continuous or Datasheet view do not work nice. Review https://www.accessforums.net/queries...nly-29163.html

    Also, you are doing this in a query, not on form. Dependent comboboxes have to be on a form because a little code is involved (unless a Data Macro can run the code). Review http://datapigtechnologies.com/flash...combobox2.html

    If you saved the alpha values, the T07_F2 combobox RowSource would simply be:
    SELECT M_English FROM T07_F2 WHERE M_English LIKE [comboboxname] & "*";
    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
    jamal numan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Ramallah, West Bank
    Posts
    113

    Question

    Quote Originally Posted by June7 View Post
    You are saving the numeric ID values in T07, not the alpha characters. This actually complicates. Dependent comboboxes with 'lookup' RowSource in Continuous or Datasheet view do not work nice. Review https://www.accessforums.net/queries...nly-29163.html

    Also, you are doing this in a query, not on form. Dependent comboboxes have to be on a form because a little code is involved (unless a Data Macro can run the code). Review http://datapigtechnologies.com/flash...combobox2.html

    If you saved the alpha values, the T07_F2 combobox RowSource would simply be:
    SELECT M_English FROM T07_F2 WHERE M_English LIKE [comboboxname] & "*";
    Thank you for the valuable answer.

    What if I include the values of the T07_F1 in the T07_F2? Does this simplify the issue?

    The screenshot and mdb are attached
    Attached Thumbnails Attached Thumbnails Clip_205.jpg  
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    If you want to do queries that join these tables then save T07_F1 pk value in T07_F2. However, that is not necessary for these dependent comboboxes to work, if the data you show in tables is actually what you will be working with.

    If the primary combobox has the English value in column 2 and the BoundColumn is set to column 1 then the dependent combobox must reference column 2 as criteria. Column index begins with 0 so column 2 is index 1.

    SELECT V_English FROM T07_F2 WHERE V_English LIKE [comboboxname].Column(1) & "*";
    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
    jamal numan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Ramallah, West Bank
    Posts
    113

    Question

    Quote Originally Posted by June7 View Post
    If you want to do queries that join these tables then save T07_F1 pk value in T07_F2. However, that is not necessary for these dependent comboboxes to work, if the data you show in tables is actually what you will be working with.

    If the primary combobox has the English value in column 2 and the BoundColumn is set to column 1 then the dependent combobox must reference column 2 as criteria. Column index begins with 0 so column 2 is index 1.

    SELECT V_English FROM T07_F2 WHERE V_English LIKE [comboboxname].Column(1) & "*";
    Many thanks for the help.

    I tried it but sounds not work with me.

    I got the message “undefined function ‘comboboxname.column’ in expression.

    The attached screenshots show how my tables are linked to each other

    Where might be my mistake?
    Attached Thumbnails Attached Thumbnails Clip_224.jpg   Clip_225.jpg   Clip_226.jpg  
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    'comboboxname' is just a generic reference for example. Use your real combobox name.
    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
    jamal numan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Ramallah, West Bank
    Posts
    113

    Question

    Quote Originally Posted by June7 View Post
    'comboboxname' is just a generic reference for example. Use your real combobox name.
    Sorry for bothering you again.

    I couldn’t know how to customize the code you have already sent to me in terms of the name of the combo box. By what should I replace the name of the “comboname” to make it work?

    What might be the proper code in terms of the names of my tables and fields? Please, kindly have a look on the attached screenshot

    Thank you
    Attached Thumbnails Attached Thumbnails Clip_251.jpg  

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I NEVER build lookups in tables. I only do it in combo and list boxes on forms.

    Dependent combobox won't work in table because requires some code to refresh the RowSource after selection in first combobox (unless Data Macro can do that - never used Data Macro).
    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
    jamal numan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Ramallah, West Bank
    Posts
    113
    Quote Originally Posted by June7 View Post
    I NEVER build lookups in tables. I only do it in combo and list boxes on forms.

    Dependent combobox won't work in table because requires some code to refresh the RowSource after selection in first combobox (unless Data Macro can do that - never used Data Macro).
    many thanks for the input.

    best

    Jamal

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    And on review, looks like I referenced wrong fieldname in the second combobox RowSource:

    SELECT M_English FROM T07_F2 WHERE M_English LIKE comboboxname.Column(1) & "*";

    or using the F1_Value field:

    SELECT M_English FROM T07_F2 WHERE F1_Value = comboboxname.Column(1);
    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.

  11. #11
    jamal numan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Ramallah, West Bank
    Posts
    113

    Question

    Quote Originally Posted by June7 View Post
    And on review, looks like I referenced wrong fieldname in the second combobox RowSource:

    SELECT M_English FROM T07_F2 WHERE M_English LIKE comboboxname.Column(1) & "*";

    or using the F1_Value field:

    SELECT M_English FROM T07_F2 WHERE F1_Value = comboboxname.Column(1);
    Many thanks June7.

    The problem persists to exist! Sounds that I don’t have sufficient capabilities to customize the codes you have already supplied to make them fit well with my tables.

    Best

    Jamal
    Attached Thumbnails Attached Thumbnails Clip_252.jpg   Clip_253.jpg  

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Don't do on tables, build forms.
    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.

  13. #13
    jamal numan is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2011
    Location
    Ramallah, West Bank
    Posts
    113
    Many thanks June for the continuous help.

    Best

    Jamal

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

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2012, 03:10 PM
  2. Dependent Combo Boxes
    By schwabe in forum Forms
    Replies: 3
    Last Post: 01-09-2012, 04:33 PM
  3. Help with dependent values
    By ceejsing in forum Access
    Replies: 6
    Last Post: 08-05-2011, 06:36 AM
  4. Import dependent
    By hawkins in forum Import/Export Data
    Replies: 2
    Last Post: 06-24-2011, 11:15 AM
  5. Dependent Combo Box
    By tigers in forum Forms
    Replies: 1
    Last Post: 06-16-2009, 12:46 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