Results 1 to 15 of 15

Thread: Combo Box Help

  1. #1
    Join Date
    Jan 2013
    Posts
    17

    Combo Box Help

    Hello Again.
    I am having an issue with my combo box. The code I am using is not populating my other boxes.
    attached is my database. and form.
    This is the code I am using for the combo box.
    It is not pulling in the data from the query.



    Private Sub Combo69_Change()
    Me.txtMATL_.Value = Me.Combo69.Column(1)
    Me.txtFINISH.Value = Me.Combo69.Column(2)


    End Sub

    I have several other fields that need to be filled in.
    I was hoping that this would work but it is not.
    Any other ideas by chance?
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,556
    I can't open your attachment, as I only run v2007. How do you define 'not working?' Nothing happens? The Controls are populated, but with the wrong data?

    As you've got it, your Combobox has to have at least three columns, with the data for txtMATL_ in the 2nd column and the data for txtFINISH in the 3rd column.

    Also, is the name of the Textbox really txtMATL_? Most unusual to have an Underline character as the last character in a name!

    Linq ;0)>
    Hope this helps!

    The Devil's in the Details!!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jan 2013
    Posts
    17
    the txtmatl and txtfinish boxes are not populating with the selection from combo boxes
    Ive also tried dlookup

    aka
    Me.txtfinish.Value = DLookup("finish", "mml_lom_1", "parts_id = '" & Me.Combo71 & "'")
    in the change()

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,556
    On the Current Record are you physically making a selection from Combo69, i.e. dropping down the list and selecting an item, as opposed to assigning a Value to the Combobox through code or by having a Default Value assigned? Events associated with Controls, such as the OnChange event, only fire when data is physically entered/selected, not when done through code.

    Linq ;0)>
    Hope this helps!

    The Devil's in the Details!!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Jan 2013
    Posts
    17
    On the current record, in the form, I am selecting by description. It is a dropdown combo box. The record should not contain any default value, for the description.
    If you look at the other boxes. It will be
    txtmanufacturer txtelec txtfinish txtU_M those are coming from (a query) I was trying
    and then tried to do a maketable query to see if it would work better.
    see the zip. it has the mml_lom table
    Attached Files Attached Files

  6. #6
    Join Date
    Jan 2013
    Posts
    17
    So should it be on afterupdate(). I've also attempted to try that too

  7. #7
    Join Date
    Jan 2013
    Posts
    17

  8. #8
    Join Date
    Jan 2013
    Posts
    17
    would this be better?Private Sub Combo71_AfterUpdate()

    Me.txtUNIT_WT_LBS.Value = DLookup("unit_weight", "mml_lom_1", "parts_id = '" & Me.Combo71.Value & " '")

    Me.Combo71.Requery

    End Sub

  9. #9
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,556
    Actually, both the OnChange and AfterUpdate events should work fine with this. Using DLookup along with a Combobox is only necessary if one of the Fields being retrieved is a Memo Field, as Comboxes will truncate them.

    I can't run the MRF_LOM1 Form or even go into Design View for the Table of the same name, because you're apparently using some Access 2010-only feature in the Table, maybe a Multi-Value Field, and I don't run 2010.

    I can't check, but are you sure that the Form in question, in question, can be updated, i.e. isn't Read-Only? Without my being able to run the Form, I can't check this out for myself, or even verify that your problem exists, on my machine. I'm really very limited in going much further for you with this; hopefully someone running v2010 will come along and have a further look at it for you.

    Linq ;0)>
    Hope this helps!

    The Devil's in the Details!!

    All posts/responses based on Access 2003/2007

  10. #10
    Join Date
    Jan 2013
    Posts
    17
    great...
    very much stuck on this stupid little part

  11. #11
    Join Date
    Jan 2013
    Posts
    17
    ok fixed
    see it now
    Attached Files Attached Files

  12. #12
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,556
    Glad you've got it working for you! But forum etiquette requires that you post what the resolution was! I can't tell what you changed, because I couldn't access your original Form. You also need to post it on the other forum where you had this posted.

    Have you noticed that you're populating a Field named FINISH with a value from a Field named UNIT_WEIGHT, rather than one named PARTS_FINISH?

    Code:
    SELECT [table_k_query_1].[PARTS_DESCRIPTION], [table_k_query_1].[PARTS_MATERIAL], [table_k_query_1].[UNIT_WEIGHT] FROM table_k_query_1 ORDER BY [PARTS_DESCRIPTION];
    As you've seen here, it'll always be easier getting help if you post a copy of your file in Access 2003 format, since many here are still running that version and cannot open 2007/2010 files.

    Linq ;0)>
    Hope this helps!

    The Devil's in the Details!!

    All posts/responses based on Access 2003/2007

  13. #13
    Join Date
    Jan 2013
    Posts
    17
    the enabled content part was failing on me
    want to shoot my foot off
    I know that the combobox.(1) does not work on web based forms.
    I will take a look at our code after lunchtime!
    shooot my foot off please

  14. #14
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,556
    If you're posting a question about web-based forms you really need to say that up front! Many things are different, when doing this kind of thing on a web-based forms!
    Hope this helps!

    The Devil's in the Details!!

    All posts/responses based on Access 2003/2007

  15. #15
    Join Date
    Jan 2013
    Posts
    17
    I saw that linq afterwards too. Thanks for the update

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •