PDA

Click to See Complete Forum and Search --> : DBcombo & text box ...


stmartin
Jul 11th, 1999, 03:49 AM
OK ... I have just started with VB6 so bear with me ....

I have a database that has two different fields ... one that's a class (ENG101) and one that's a Description (English 101) ... I need to bound those two together so when I pick one then the other one Automatically shows up.

I want to use a DBcombo box control for picking the class and I would guess a text box for showing the description of the class I just picked ...

Can this be done?
If so ... HOW ?

Any help is GREATLY appreciated.

Shawn

thorne
Jul 11th, 1999, 08:12 AM
If you are using an access database then you can bind the DBCombo box to the .mdb file. To do so, put a data control on your form.

Set DatabaseName to the database you will be using.

Set Recordsource to the table in the database you are using. (I would guess you only have one table in your database)

Set DataSource on DBCombo to the name of the data control.

Set DataField of DBCombo to the correct field (in this case Class name)


Set Text1(or whatever you text box is called) DataSource to the name of the data control.

Det Datafield of Text1 to the correct field (class description).

Of course this will display the class description all the time.

If you want to only show the class description when they have selected a class then set the datafield and datasource in the code:

text1.datasource = name of datacontrol
text1.datafield = name of field

then after they are done set them to ""