Hi there,

i need some help as i'm new with using comboboxes :)

i have a table in a MS access database named "CUSTOMER" and in my vb form i have a combobox (name: cmb1). I want to display the names of my customers in my combobox when the form loads and when i search the combobox and select a particular person, i want the other values in the table to be displayed in textboxes......

any ideas please??? thank you very much

Recommended Answers

All 5 Replies

hi
select cobobox and in right you will see the properties
1/datasource make its value the table in dataset you want
2/ ValueMember make its value the coulmn name (name of custeomer)

when your form load you fill dataset

Me.DataSet11.Clear()
Me.OleDbDataAdapter1.Fill(DataSet11)

now the list of comboBox has the names of ur customers

i hope this help

hi and thanks for your reply. however i have been able to do that fill. my query is this.

I have 3 textboxes on my form.
when i select the item from the combobox i need the 3 textboxes to be filled with the data corresponding to that field. ( what i'm trying to say is that i have a table in macces with 4 rows, one of them is the field chosen in the combobox. now when i select the item i want the textboxes to display the latter of the record)

thanks
lukis

hi:cheesy:
i used dataset and dataadptor for display the other data in text box
the sql query will be like this

select email , name
from customer
where id =?

then douple click in combobox and write this code (douple click means the code will excute when user select value )

'here you select the row from table with id that user choose from comboBox
OleDbDataAdapter2.SelectCommand.Parameters("ID").Value = Me.ComboBox1.Text

        Me.DataSet21.Clear()
        Me.OleDbDataAdapter2.Fill(DataSet21)

        TextBox1.Text = DataSet21.Tables("customer").Rows(0).Item("email")

        TextBox2.Text = DataSet21.Tables("customer").Rows(0).Item("name")

i hope this what u want

manal

guys imagine i have this table

Rest_type Rest_name Tel Location
----------- ------------ --- ----------

ala carte del pinto 2345546 Dublin
pizzeria francesco's 3455667 Rome


now i have a form with a combobox (cbRests), and 2 textboxes (txtType, txtTel)

i have been able to include the Rest_name in the combobox but i need to fill in the textboxes with the relevant info...ex

when i select del pinto from the combobox, i want the textboxes to display ala carte and 2345546....how can i do that......in code please as i have no idea on how to do that.... thank you very much...your help is very much needed here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.