Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2004
    Posts
    85

    Angry Unanswered: Combo Boxes on a form

    ok im not the smartest gal in the world but i try

    what i want to do:
    have a combo box that displays rows of information from a excell spreadsheet
    > I have done that... *Snaps for me

    ok but what i want to do is when i select a row i want from the drop down box, i want it to put it in a field or displayed on the form. Oh yeah its on a form that im making

    ummm all i can get it too do is show one of the columns of information

    if you answer it *snaps for you
    a easy to understand answer *snap *snap

    Jess xxx

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    yourTextFiledNae= yourCombBoxName

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Or try
    yourTextBoxName=YourcombBoxName.Column(0,YourcombB oxName.ListIndex)

    and put it in the after update event of the Combo

  4. #4
    Join Date
    Apr 2004
    Posts
    85

    aalllriighty then

    ooh that sounds hard

    i will give it a crack full explanation would be cool

    but *snap for you
    xxx jess

  5. #5
    Join Date
    Apr 2004
    Posts
    85

    Still No Luck

    Can someone help me please

  6. #6
    Join Date
    Feb 2004
    Location
    Colorado state
    Posts
    65
    Jessy, I don't know if this will help but the combo boxes that I have are set up so that when I click on an entry the whole record populates the form. I did it with no coding. Just the way the combo box is set up. when you set up the combo box use the last option and tell access to look for the record that you type in. Say you want to look up records by last name, you type the last name in and hit enter. the rest of the fiels populates.

    Don't know if this helps, I maybe way off base regarding your question.

    Mike

  7. #7
    Join Date
    Apr 2004
    Posts
    85

    still cant get it

    what i want to do is


    make a text box say or have the information i choose from a combo box

    any more ideas help me please

    its on a access form that i made i have a combo box with a list of fields example

    4231 john smith newcaste NSW 0418556556
    '' '' '' '' ''

    when i chose one i want it displayed on the form in a text box

  8. #8
    Join Date
    Apr 2004
    Location
    Scotland
    Posts
    24
    Jessy

    try this ,

    it sorta does what you want except it takes the selection from the cbo box and puts it into another combo box.

    If you look at the code i think you could change where the selected value goes into (ie not the cbo but me.txtBoxName.value = cboSelected.value) or something - not sure on the code)

    Try Hammbakka's code that should do it!

    Anyways hope that gives you a nuge in the correct direction!
    Attached Files Attached Files

  9. #9
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    I'll preface this with the code I'm posting as an example will probably overwhelm you ... But this code is an example of extracting columns from a combobox and populating other fields ...

    Code:
    Private Sub SugSupplierComboBox_AfterUpdate()
        Dim HavePhone As Boolean, HaveContact As Boolean
        
        HavePhone = False
        HaveContact = False
        
        ' Company Name
        SupplierInfoTxt.Value = SugSupplierComboBox.Column(2, SugSupplierComboBox.ListIndex + 1)
        ' Address
        If SugSupplierComboBox.Column(3, SugSupplierComboBox.ListIndex + 1) <> "" Then
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf & SugSupplierComboBox.Column(3, SugSupplierComboBox.ListIndex + 1)
            ' 2nd line of address
            If SugSupplierComboBox.Column(4, SugSupplierComboBox.ListIndex + 1) <> "" Then
                SupplierInfoTxt.Value = SupplierInfoTxt.Value & " / " & SugSupplierComboBox.Column(4, SugSupplierComboBox.ListIndex + 1)
            End If
        End If
        ' City, State & Zip
        If SugSupplierComboBox.Column(5, SugSupplierComboBox.ListIndex + 1) <> "" Then
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf & SugSupplierComboBox.Column(5, SugSupplierComboBox.ListIndex + 1)
            If SugSupplierComboBox.Column(6, SugSupplierComboBox.ListIndex + 1) <> "" Then SupplierInfoTxt.Value = SupplierInfoTxt.Value & ", " & SugSupplierComboBox.Column(6, SugSupplierComboBox.ListIndex + 1)
            If SugSupplierComboBox.Column(7, SugSupplierComboBox.ListIndex + 1) <> "" Then SupplierInfoTxt.Value = SupplierInfoTxt.Value & " " & SugSupplierComboBox.Column(7, SugSupplierComboBox.ListIndex + 1)
        End If
        ' Contact & EMail
        If SugSupplierComboBox.Column(10, SugSupplierComboBox.ListIndex + 1) <> "" Then
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf & vbCrLf & "Contact: " & SugSupplierComboBox.Column(10, SugSupplierComboBox.ListIndex + 1)
            HaveContact = True
        End If
        ' Email
        If SugSupplierComboBox.Column(11, SugSupplierComboBox.ListIndex + 1) <> "" Then
            If Not HaveContact Then
                SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf & vbCrLf & "Contact: "
            Else
                SupplierInfoTxt.Value = SupplierInfoTxt.Value & " / "
            End If
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & SugSupplierComboBox.Column(11, SugSupplierComboBox.ListIndex + 1)
        End If
        ' Phone
        If SugSupplierComboBox.Column(8, SugSupplierComboBox.ListIndex + 1) <> "" Then
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf & "Ph: " & SugSupplierComboBox.Column(8, SugSupplierComboBox.ListIndex + 1)
            HavePhone = True
        End If
        ' Fax
        If SugSupplierComboBox.Column(9, SugSupplierComboBox.ListIndex + 1) <> "" Then
            If Not HavePhone Then
                SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf
            Else
                SupplierInfoTxt.Value = SupplierInfoTxt.Value & Space(4)
            End If
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & "Fx: " & SugSupplierComboBox.Column(9, SugSupplierComboBox.ListIndex + 1)
        End If
        ' Cell
        If SugSupplierComboBox.Column(13, SugSupplierComboBox.ListIndex + 1) <> "" Then
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf & "Cell: " & SugSupplierComboBox.Column(12, SugSupplierComboBox.ListIndex + 1)
        End If
        ' Website
        If SugSupplierComboBox.Column(12, SugSupplierComboBox.ListIndex + 1) <> "" Then
            SupplierInfoTxt.Value = SupplierInfoTxt.Value & vbCrLf & "Web: " & SugSupplierComboBox.Column(12, SugSupplierComboBox.ListIndex + 1)
        End If
        
        If IsNewPO Then
            SupplierID = CLng(SugSupplierComboBox.Value)
            ' Retrieve supplier's available items
            RetrieveSuppliersItems
        End If
    End Sub
    Enjoy!

  10. #10
    Join Date
    Apr 2004
    Posts
    85

    still no luck

    wow thats a bit of code you got going there. *Snaps for effort

    but im simple and wouldnt know what to do with it

    okay im still finding it hard to get what i want done... because the combo box contains lines of information from columns of a excell database
    e.g

    name number adressss
    '' '' ''
    '' '' ''
    '' '' ''

    when i choose one i want it displayed somewhere on the form


    at this stage all i can get is the one column displayed like just the Name field, i want the whole row of information displayed, and when you suggest some code, i need to know where to put it.

    *snaps for the people who replied

    jess xxx

Posting Permissions

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