Results 1 to 6 of 6
  1. #1
    CT_AccessHelp is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    40

    Combo box not displaying but is saving to the table

    Good Morning,



    I have a combo box that should be displaying a list of codes based on the selection of fund types in another combo box. If I select somewhere in the "Sub_BOC1" combo box that is not displaying the list of codes it saves a record in the table. Any Ideas why this is happening? I have provided a picture of the form and code, hope it helps. Thank you!

    The row source for the combo box bound to the field "CNTY" Code:
    SELECT DISTINCT County FROM tbl_Accnt_code ORDER BY County

    In the after update event of the combo box CNTY Code:
    Private Sub County_AfterUpdate()
    Me.Accounting_Code.Requery
    Me.Accounting_Code.Value = Null
    Me.Accounting_Code.SetFocus
    End Sub

    And the row source for the "Accounting_Code" combo box Code:
    SELECT [AccountingCode] FROM tbl_Accnt_code WHERE [County] = Forms!frm_Expend.CNTY ORDER BY [AccountingCode]

    NOTE: THE CODE ABOVE WORKS FINE.


    The row source for the combo box bound to the field "Fund" Code:
    SELECT DISTINCT Fund_Type FROM tbl_Fund_Type ORDER BY Fund_Type

    In the after update event of the combo box Fund Code:
    Private Sub Fund_AfterUpdate()
    Me.SUB_BOC1.Requery
    Me.SUB_BOC1.Value = Null
    Me.SUB_BOC1.SetFocus
    End Sub

    And the row source for the "SUB_BOC1" combo box Code:
    SELECT [SUB_BOC] FROM tbl_Items_BOC WHERE [Fund_type] = Forms!frm_Expend2.Fund ORDER BY [SUB_BOC]



    Click image for larger version. 

Name:	FundType.png 
Views:	15 
Size:	14.7 KB 
ID:	15008

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Try:

    Give the Fund combobox a name different from the field, like cbxFund, then:

    SELECT [SUB_BOC] FROM tbl_Items_BOC WHERE [Fund_type] = [cbxFund] ORDER BY [SUB_BOC]
    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
    CT_AccessHelp is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    40
    Thank you, I tried it and nothing changed, it is still not displaying the list.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    I've had comboboxes corrupt. I had to delete and recreate.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    CT_AccessHelp is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    40
    Thanks I have attached a copy.
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    The SUB_BOC1 combobox RowSource has only one field. Change properties:
    RowSource: SELECT [SUB_BOC] FROM tbl_Items_BOC WHERE [Fund_type]=[Fund] ORDER BY [SUB_BOC];
    ColumnCount: 1
    ColumnWidths: 1"

    Set the Fund combobox RowSource to:
    SELECT Fund_Type FROM tbl_Fund_Type ORDER BY Fund_Type;

    When you changed the Fund combobox name, need to change the event procedure name. Just change the name back to what it was.

    Why doesn't the CNTY combobox pull RowSource from tbl_fsacnty_mn?
    SELECT County FROM tbl_fsacnty_mn ORDER BY County;

    Suggest the combobox requery be in the GotFocus event instead of AfterUpdate so that if user goes to the combo without changing Fund, the RowSource will filter properly:
    Private Sub SUB_BOC1_GotFocus()
    Me.SUB_BOC1.Requery
    End Sub

    Do similar for Accounting_Code:
    Private Sub Accounting_Code_GotFocus()
    Me.Accounting_Code.Requery
    End Sub
    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. Saving Values from Combo Boxes in a Table
    By sidewinder2 in forum Forms
    Replies: 12
    Last Post: 07-11-2013, 12:47 PM
  2. Form-Combo Box-Saving value to table
    By Jill in forum Forms
    Replies: 2
    Last Post: 12-06-2012, 03:13 PM
  3. Combo Box NOT saving correct value
    By supracharger in forum Forms
    Replies: 8
    Last Post: 06-03-2012, 02:25 PM
  4. saving Combo Box selection to a table
    By rmiell in forum Access
    Replies: 1
    Last Post: 10-04-2011, 11:38 AM
  5. Combo Box not saving to table
    By dgriffin in forum Forms
    Replies: 11
    Last Post: 06-08-2011, 03:04 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