Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17

    Unhappy Cascading Combo Box - How to save selected item?

    I have the following tables:
    1. DATA (to store data for all my records). First 3 columns are DataID, Sector Type, and Sector Name.
    2. TblSectorType (with SectorTypeID, and SectorType) Sector types are: Operational and Corporate.
    3. TblSector (with TblSectorID, Sector, SectorLongName, and TblSectorTypeID) - Sector is the acronym vs long name. Five Sectors are "Corporate"(1) while the others are "Operational"(2).


    I have a form with two cascading combo boxes

    1. Sector Type with two listed choices: "Corporate" and "Operational"
    2. Sector with a list of Sectors (both acronyms and associated long names are listed) filtered based on selected type above.


    The two combo lists seem to work fine in terms of filtering, using an AfterUpdate requery macro for Sector type, and a SELECT criteria for the Sector Row Source.

    The problem is that my selections do not save properly in the DATA table. Sometimes, a number ID?) gets inputted but some other times, the Sector Type field remains blank (???). I can never get the actual Sector Type (Operational or Corporate) to show in DADA table nor in my form after selection. Similar issue with Sector value.

    Can someone help me with that?

  2. #2
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Is your form bound to your table?

  3. #3
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17
    My DATA table is the Record Source. Is this what you mean?

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,446
    is your SectorType field a lookup field in your table?

  5. #5
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

  6. #6
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17

    Works but...

    Quote Originally Posted by Ajax View Post
    is your SectorType field a lookup field in your table?
    Got it. So I made both my SectorType and my Sector fields lookup fields in DATA table. I made filters. Both fields now input correctly in the table. Thanks! Now there is an issue with the form. The SectorType shows OK. As for the Sector, it sometimes do, sometimes not. However, if I re-select the SectorType, then the right Sector gets automatically selected. But it disappears as soon as I move to the next record.

    Thanks for your help!

    Pascale

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,446
    the point was that lookup fields cause problems, not that they provide a solution

    But it disappears as soon as I move to the next record.
    this implies you have a continuous form

  8. #8
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17
    Sorry. I don't understand. What should I do? Should I make my form "continuous"? How do I do that?

  9. #9
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,446
    Should I make my form "continuous"?
    no, just as you shouldn't have changed your fields to lookups.

    I'm trying to get some information as to how your form is supposed to work. Please provide the following:

    For both combo's provide the rowsource, the controlsource, the column count and the bound column values plus details of any code/macros associated with these two controls

    Also provide the recordsource to the form

  10. #10
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17
    Field
    SectorType Sector
    Row Source SELECT TblSectorType.TblSectorTypeID, TblSectorType.[Sector Type]
    FROM TblSectorType
    ORDER BY TblSectorType.[Sector Type];
    SELECT TblSector.TblSectorID, TblSector.Sector, TblSector.[Sector - Long Name], TblSector.TblSectorTypeID
    FROM TblSector
    WHERE (((TblSector.TblSectorTypeID)=[Forms]![DATA ENTRY]![CbxSectorType]))
    ORDER BY TblSector.Sector;
    Control Source SectorType Sector
    Column Count 2 3
    Bound Column 1 1
    Code/Macro Event - AfterUpdate: Requery CbxSector NIL
    Record Source to the Form SELECT DATA.DataID, DATA.Sector, DATA.[Sector Type], DATA.Contact, DATA.[Meeting Date], DATA.Issue, DATA.[Mitigation/Initiative], DATA.Timeframe, DATA.[Strategic Linkage], DATA.[Summary Notes]
    FROM DATA;

  11. #11
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,446
    to clarify - what are your storing in

    DATA.[Sector Type]?

    The TblSectorType.TblSectorTypeID or TblSectorType.[Sector Type]?

    And do you have any code in the form current event to requery CbxSector? Otherwise if the next record has a different value for DATA.[Sector Type], it won't show anything.

    Other issues - the control source to cbxSectorType is SectorType, but in your recordsource you are bringing through DATA.[Sector Type]

    Just a tip - don't have spaces or non alphanumeric characters in field and table names - at some point you will find you have wasted hours or days trying to resolve a misleading error message


  12. #12
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17
    [QUOTE=Ajax;337029]to clarify - what are your storing in
    DATA.[Sector Type]?
    The TblSectorType.TblSectorTypeID or TblSectorType.[Sector Type]?

    I am storing the SectorType (Corporate or Operational)

  13. #13
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17
    And do you have any code in the form current event to requery CbxSector? Otherwise if the next record has a different value for DATA.[Sector Type], it won't show anything.

    I cannot see the codes. In After Update, I clicked [...] then selected Macro Builder. Then from the list, I picked "Requery" and then I inputted the control Name "CbxSector".

  14. #14
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17
    Other issues - the control source to cbxSectorType is SectorType, but in your recordsource you are bringing through DATA.[Sector Type]

    How to fix that?

  15. #15
    Pascale is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    17
    Just a tip - don't have spaces or non alphanumeric characters in field and table names - at some point you will find you have wasted hours or days trying to resolve a misleading error message
    [/QUOTE]

    Thanks for the tip!

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combo box not displaying selected item name
    By dovberman in forum Forms
    Replies: 12
    Last Post: 02-01-2016, 12:39 PM
  2. Replies: 5
    Last Post: 06-24-2015, 02:45 PM
  3. Combo box - Open at last item selected
    By mitchy1111 in forum Programming
    Replies: 2
    Last Post: 10-07-2011, 07:23 AM
  4. Replies: 7
    Last Post: 08-31-2011, 05:09 PM
  5. How to save cascading combo box value
    By mar_t in forum Access
    Replies: 2
    Last Post: 01-20-2011, 06:37 PM

Tags for this Thread

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