Learn how to a build a cloud-first strategyRegister Now


vb.net combobox binding to ms access

Posted on 2005-04-23
Medium Priority
Last Modified: 2006-11-18

Is there a simple way to bind a vb.net combobox to a ms access table?

And if you have two comboboxes on a form, how do you bind the second combobox to the same table displaying data using the dis played data from the first combobox as the criteria?

Thanks in advance
Question by:abennett10
  • 3
  • 3
LVL 28

Expert Comment

ID: 13852051
create a dataset from th table and then

cboA.DataSource = ds1.Tables(0).DefaultView
cboA.ValueMember = ds1.Tables(0).Columns("id").ToString
cboA.DisplayMember = ds1.Tables(0).Columns("name").ToString

Author Comment

ID: 13852104

But how does the second combobox retrive it's data to Display from the criteria set by cboA?
LVL 28

Accepted Solution

iboutchkine earned 1500 total points
ID: 13852134
when you create dataset you are using SQL for example
sSQL = "select FieldName from Table1"
now you create ds1

after that you select the Value in the combobox and use it for you new SQL

sSQL = "select Whatever from Table1 where FIeldName = '" & cboA.Text & "'"
watch quotes in case it is a string and do it without quotes if it is a number

now create a second dataset ds2 and bind it to cboB

cboB.DataSource = ds2.Tables(0).DefaultView
cboV.ValueMember = ds2.Tables(0).Columns("id").ToString ' or what ever column you need
cboB.DisplayMember = ds2.Tables(0).Columns("name").ToString
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 13852144
Thank you! That will do it!
LVL 28

Expert Comment

ID: 13852162
Can I ask you , why grade B? Is something wrong?

Author Comment

ID: 13852265
Well.....not to sound ungrateful, because I'm not trust me.....I just was hoping you would give me an example with more detail Emphasizing the syntax more....that's all

But I really do appreciate the response and answer

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question