none
MS Access 2016 Combo Box RRS feed

  • Question

  • I'm an old gun VB developer from the <g class="gr_ gr_56 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-del replaceWithoutSep" data-gr-id="56" id="56">90's,</g> since moved to SQL, Technical Business Analysis, Solution Architecture<g class="gr_ gr_103 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation multiReplace" data-gr-id="103" id="103">....</g>

    I need to build a quick Access Desktop frontend to survive the cut off of Access Services on SharePoint. We are small but 3 separate sites. So we want to just simply have a SQL Database on Azure with the Access Desktop app hitting that. This will functionally be exactly the same as the functioning Web App which the users love.

    ....... My Problem!

    I need to use a combo box to display ref data from another table and of course just store the key to the table in each row of the dynamic table. That works fine but... it displays the key and not the value when you return to that row, which is not helpful. Most frustrating!

    No doubt this is simple but I am not seeing it. Can some someone please help ... quickly if at all possible.

    Thanking you in advance,

    Rohan

    Tuesday, February 6, 2018 4:18 AM

All replies

  • I am not sure I understand but see the ComboBox.BoundColumn Property. The sample shows "how to create a combo box that is bound to one column while displaying another". Does that sound like what you need to do? I think that sample is not good because it uses "Select *" instead of specifying the relevant fields but that is a minor issue. I guess that the part of what you are saying that is confusing is that "the value" seems vague to me so I am not sure what you are askiing.


    Sam Hobbs
    SimpleSamples.Info


    Tuesday, February 6, 2018 5:06 AM
  • Hi Rohan Bacon,

    You had mentioned that,"I need to use a combo box to display ref data from another table and of course just store the key to the table in each row of the dynamic table. That works fine but... it displays the key and not the value when you return to that row, which is not helpful."

    If you are using the combo box control then you need to store Index value and text value both in combo box.

    You need to use 2 columns in your combo box.

    Then you can set the width of index column to 0.

    So when you view it will just display the text value but you can only store the index value to your table.

    Below is the example that you can try to refer.

    In which I assign some data from table to combo box control.

    I only display the text value and I also display the index value in separate textbox.

    Table:

    Code:

    Option Compare Database
    
    Private Sub Combo0_Change()
    Me.Text2.Value = Me!Combo0
    End Sub
    
    Private Sub Form_Load()
    Dim strSQL As String
    
     strSQL = "Select [index_no],[product_name] FROM [p_data]"
    
     Me!Combo0.RowSource = strSQL
    Me!Combo0.ColumnCount = 2
    
    Me!Combo0.ColumnWidths = "0cm ; 2 cm"
    
    End Sub
    
     

    Output:

    Further, You can try to modify it based on your requirement and implement it.

    Let me know, If I miss anything in your above description.

    You can try to share the sample code and snap shot of your combo box and desired result.

    We will again try to provide you further suggestions to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 7, 2018 2:34 AM
    Moderator
  • Somehow my response got posted without the link. I meant to provide the link; I always do except when there is a mistake as in here. I have added the link.


    Sam Hobbs
    SimpleSamples.Info

    Wednesday, February 7, 2018 4:28 AM
  • I think that is essentially the same as the example in the documentation. I apologize that my response was posted without the link; that was a mistake.


    Sam Hobbs
    SimpleSamples.Info

    Wednesday, February 7, 2018 4:29 AM
  • Hi Rohan Bacon,

    Is your issue solved?

    I find that you did not follow up this thread after posting the issue.

    If your issue is solved then I suggest you to post your solution and mark it as an answer.

    If your issue is still exist then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 9, 2018 9:28 AM
    Moderator