Results 1 to 4 of 4
  1. #1
    maxchang9 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    7

    How to apply filter on combo box & passing value between forms

    First of all, my Access is written in Chinese, but ill try my best to illustrate my question
    -------------------------------------------------------------------------------------------------
    Table A Import ingredients ----->Form I
    Table B Import Details ----->Form II
    Table C Ingredients Details ----->Form III
    Table D Supplier Details

    Relations:

    Table D 1-------- Table A 1-------- Table B


    Table D 1-------- Table C 1-------- Table B
    ------------------------------------------------------------------------------------------


    I Got a Form I (Table A) that contains a sub-form (Table B)
    User insert date/ branch/ supplier on the boxes above (belongs to Table A), and insert Ingredient name / price/ number in the sub-form. (belongs to Table B)

    Click image for larger version. 

Name:	1.jpg 
Views:	28 
Size:	98.9 KB 
ID:	36246
    The 1st column in sub-form ( name of ingredients) are link to Table C which hold all ingredients details. I create a combo box so user may select.

    The problem is, when the list gets too large, user will find difficult to find the right ingredient. (since Chinese character can't sort in alphabetical order)

    The solutions i came up with are:

    1. Apply filter within the combo box (in sub-form : ingredient): Since user previously select the "supplier" in the combo box above, is there a way to filter out other ingredients which aren't link to the supplier

    2: Introduce search feature: I create Form III(Table C) which allow user to search ingredient through typing. (I wrote macros within the button).


    Click image for larger version. 

Name:	2.jpg 
Views:	26 
Size:	129.1 KB 
ID:	36247
    The problem is, how do i pass the selected data from Form III back to Form I (inside it's sub-form)??

    I am still learning Access while making this, so any suggestion will be appreciate. Thank you.
    Last edited by maxchang9; 11-20-2018 at 03:43 AM. Reason: fixing

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Option 1 sounds like you are asking for what is called cascading or dependent combobox. This is a common topic.

    Option 2 could be done with code behind Form III that sets: a) global variable or b) TempVar or 3) textbox on Form I
    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
    maxchang9 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    7
    Thanks man, i spend hours on digging cascading combo-box and finally got it to worked. However, as i proceed ,more questions occur.

    1. In order to apply cascading combo-box in the sub-form, i set criteria ([forms]![formI]![combo box]) on it's source (table B) .

    However, when i edit the tableB: ingredient (without open Form I), a pop up occur and ask me for parameter ( which i have to enter supplier manually before i start edit)

    Is there a way to fix this? ( exp: if Form I not open, do not apply this criteria)

    2. I learned how to create and set tempVar value while loading a form, however i am struggling in passing value between different objects (within same form)

    i.

    Click image for larger version. 

Name:	rrrr.jpg 
Views:	19 
Size:	99.5 KB 
ID:	36322
    For instance, how do i pass value from textbox -> subform ? if using macro/expression, which is "action" am i going to use? Do i need a button to assist? or it can be done in focus/dbl click event?
    -------------------------------------------------------------------------------------------------------------------------------------------------------------
    ii.
    Click image for larger version. 

Name:	rrr2.jpg 
Views:	17 
Size:	152.3 KB 
ID:	36324

    how do i set TempVar (i created it when this Form III is load) to the value i highlight when the user click it's corresponding checkbox (on its left). The Form is a continues form

    Thank you so much for the answer. The biggest upset is not knowing the "correct question" for the answer i seek. So even a hint or keyword will be very appreciate.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I have never used TempVar. But I suppose you would use checkbox AfterUpdate event to set the TempVar value.

    Suggest using GotFocus event of the conditional combobox to set its RowSource or just Requery.

    However, be aware cascading combobox (or listbox) that has lookup alias will not work nice on Continuous or Datasheet form.
    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. Apply Filter with Combo Box
    By Fiache in forum Access
    Replies: 2
    Last Post: 03-16-2017, 03:31 PM
  2. Apply Filter to a Table using Combo Box
    By krizzyd in forum Forms
    Replies: 1
    Last Post: 11-27-2016, 04:05 PM
  3. Apply FIlter from Combo Box
    By Trilback in forum Forms
    Replies: 1
    Last Post: 11-03-2016, 11:52 AM
  4. Replies: 9
    Last Post: 08-05-2014, 03:09 PM
  5. Replies: 2
    Last Post: 02-25-2013, 10:47 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