I'm new to VB 2008 Express, but I want to produce a user interface (a form linked to an access database).
Comboboxes and textboxes work fine. Each box being linked to a separate database column.
My main problem is with duplicate entries in each database column. I want the 1st combobox to display the range of entries in column 1, say 1,2,3,4 & not 1,1,1,2,2,2,3,3,3.
For example, if 2 were selected, then the entries in the 2nd combobox would show only those relevant to any entry of 2 in the 1st column of the database, but again, only the range would be displayed. The idea is to end up with a single entry being displayed in a final textbox, based on a narrowing band of selection from a number of comboboxes....any help would be highly appreciated - thanks

Recommended Answers

All 4 Replies

Use select statement with DISTINCT.

Hello adatapost
Thanks for your post, as I'm new to VB, I'm still trying to workout how this statement fits into the solution I'm looking for....It's a steap learning curve, but I'm sure it will improve....eventually!

commented: I am sure you will do it by yourself. Thanks. +11

i cant get you plz paste your code
example:
oledbconnection a=new oledbconnection(" ")
a.open()
oledbcommand........
oledbreader c........

int i=0
while c.read()
i=i+1
combobox1.items.add(i)
End while
a.close()
private void combobox1_indexchanged(..............
a.open()
n=combobox1.selecteditem()
for i=0 to n
c.read()
end for
s=c.item(1)
combobox2.items.add(s)
combobox2.selecteditem=s
a.close()

it might hava got lot of syntax errors but this is the idea i have got

Hello Kalpsanu - thanks for the reply....I'm afraid I'm a beginner!

To spell out fully what I'm trying to do -

I have 11 Access tables, 10 of which each have 2 columns (a unique ID keys and unique corresponding entry). In the 11th table, each column represents the ID Key from each of the previous 10 tables. There is a final column in table 11, which contains Part Numbers.

Table 11 contains all of the combinations possible - 1500 entries, which result in only 12 different Part Numbers. Therefore, there will be a lot of duplicate entries in table 11.

Each of the 1st 10 tables are linked to seperate Comboboxes, which contain the entries from the 2nd column of the 10 tables.

Table 11 is linked to a Textbox, which will just display a part number.

The idea is that when the form is opened, all entries displayed are blank. Any of the 10 Comboboxes can be selected and the option selected. Depeneding on what value is selected, will effect what corresponding values are displayed in the next selection available from another Combobox. This will go on until all selections have been made from all of the Comboboxes. Only then will a Part Number appear in the final Text box.

I've set up all tables in VB 2008 Express and can get them to display correctly in each Combobox and Textbox. The problem I have is linking the tables / Comboboxes so that each previous selection from a Combobox will limit the options available from the next Combobox.

Can anyone please help?

Thanks

aalto

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.