Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Contents of ComboBox to Populate other fields

Status
Not open for further replies.

vastyle

IS-IT--Management
Dec 31, 2007
2
CA
Hi Guys,

I have a problem, I have a worksheet that basically has contact info of individuals. like company name (1 clol) First Name (2 col), Last (3 col) etc.

I have used company name column to populate a combobox. wat i am tryin 2 achieve is, when i select a company from d drop down menu, and click on a command button called View Contact. I want to be able to find the company name on d worksheet under d company name column, then using that information (i.e row number) to populate all the other textbox fields (first name, last name, etc) which are basically Offsets (0,1..etc) of d same row.

Anyone out there have an idea how to do this
 
Try this,
I found origional source here:
Code:
Sub Get_vals

 Dim Employee As Variant
    Dim Name As String
    Dim firstaddress As String

    Employee = Empty
     'If you add more than 500 names you will need to increase this
    With Sheet1.Range("A:A")
        Name = no
        Set Employee = .Find(What:=Name, LookIn:=xlValues, LookAt:= _
       xlWhole)
'        If Not Employee Is Nothing Then  Else: Exit Sub

        If Not Employee Is Nothing Then
'''        MsgBox Employee.Row
        lines.Label1.Caption = Sheet1.Cells(Employee.Row, 2)
       etc.....
        End If
End sub
 
Thanks Guys would try it out and let u know how it goes
 



Hi,

I use MS Query often to return a list based on a criteria selected from a ComboBox control.

faq68-5829

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
You can even do this with just simple formulae.

Link your combobox to cell A1 and then just put e.g. vlookups [ =IF(ISNA(VLOOKUP()),"",VLOOKUP()) ]in B1, C1, etc and link those cells to your textboxes.

Cheers,

Roel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top