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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to populate fields using combo box? 1

Status
Not open for further replies.

etalent

Programmer
Jun 9, 2003
23
0
0
US
How do I populate a field in one table by selecting from a combo box with a control source of another table?

I've got 4 tables, with fields and relations as follows...

tblInfinitives
fldInfId
fldConId
fldInfEng
fldInfEsp
fldInfPor

tblConjugations
fldConId
fldConEsp
fldEspTenseId
fldConPor
fldPorTenseId

"tblConjugations.fldConId" has 1 record related to many records in "tblInfinitives.fldConId"

tblEspTenses
fldEspTenseId
fldEspPresentParticiple
fldEspPastParticiple
fldEspImperative

"tblConjugations.fldEspTenseId" has a 1 to 1 relationship with "tblEspTenses.fldEspTenseId"

tblPorTenses
fldPorTenseId
fldPorPresentParticiple
fldPorPastParticiple
fldPorImperative

"tblConjugations.fldPorTenseId" has a 1 to 1 relationship with "tblPorTenses.fldPorTenseId"

"qryVerbs" is a query, which includes all of the fields of all of the tables.

"frmVerbs" is a form with a bunch of text boxes and 2 combo boxes. These controls and their control sources are as follows:

"txtEng" is a text box with control source "qryVerbs.tblInfinitives_fldInfEng"

"txtEsp" is a text box with control source "qryVerbs.tblInfinitives_fldInfEsp"

"txtPor" is a text box with control source "qryVerbs.tblInfinitives_fldInfPor"

"txtEspPresentPart" is a text box with control source "qryVerbs.tblEspTenses_fldEspPresentParticiple"

"txtEspPastPart" is a text box with control source "qryVerbs.tblEspTenses_fldEspPastParticiple"

"txtEspImperative" is a text box with control source "qryVerbs.tblEspTenses_fldEspImperative"

"txtPorPresentPart" is a text box with control source "qryVerbs.tblPorTenses_fldPorPresentParticiple"

"txtPorPastPart" is a text box with control source "qryVerbs.tblPorTenses_fldPorPastParticiple"

"txtPorImperative" is a text box with control source "qryVerbs.tblPorTenses_fldPorImperative"

"cboEspCon" is a combo box, and "cboPorCon" is a combo box, the control source of both is what I need help with.

Here is a description of the desired functionality of form "frmVerbs"...

1. Enter a value in "txtEng," "txtEsp," and "txtPor"

2. Select a value from either "cboEspCon" or "cboPorCon," which sets the value for "tblInfinitives.fldConId", and in turn, sets the values of all of the remaining text boxes.

In other words, it's very simple. You enter a word in "txtEng," in "txtEsp," and in "txtPor."

Then you select a value from "cboEspCon" or "cboPorCon," which, in turn, sets the values of "txtEspPresentPart," "txtEspPastPart," "txtEspImperative," "txtPorPresentPart," "txtPorPastPart," and "txtPorImperative."




 
just set the values of the textboxes in the on_change event of the combobox. I might have misunderstood what you're trying to do, but if all you want to do is set the values of the textbox when you select as specific value from the combobox you could just do it on change. Of course if the textboxes are bound to a table there will be a problem with trying to set the values, in that case you'd have to edit the fields that the textboxes were bound to in the recordset in the on_change of the combobox.
 
You said "...if the textboxes are bound to a table..you'd have to edit the fields that the text boxes were bound to in the recordset in the on_change of the combo box."

That's precisely what my circumstance is. I'm really, really green. I'm not at all a "programmer." That shouldn't be under my name.

Can you give me actual lines of code? Please look at my original post to see the relationships. Better still, let me email you the little database. Thanks!
 
email me the db, make sure that you zip it before you email tho or else my isp's virus checker will remove the attachment. jtseleie@theedge.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top