Problem calling a table

wiadus

New member
Joined
Jun 24, 2005
Messages
2
Programming Experience
Beginner
I have 3 tables Table1, Table2 and Table3. Table3 has 10 columns and in Table2 there are two columns which are the same as two columns in Table2.
Table2 primary key is a foriegn key in Table3. I have this Table2 and Table3 on my form. Now I would like to add data to Table3 so I have ten text boxes and I have a ComboBox1 which generate the names in Table2. Now instead of typing in the two textboxes which has the same values in Table2, I want the user to select one of the names from ComboBox1 and whenever
it is selected the two textboxes will be filled with the values from Table2, because the same data is need if it changes it can not be updated because they are primary keys from Table1 and Table2. I have manage to get the names in the combobox1 but whenever I select from the combobox1 then I get error.I would be much grateful if one of you can help me because I think it is not good practice to enter data in table2 and enter the same in Table3 while it can be call to fill the textboxes. I hope you can help. below is how the tables look like, GosID and HosID is needed. Thanks

Table1 (HosID, HosName) Table2(GosID, GosName, HosID) Table3(CosId, CosDate, HosID, GosID)
 
If Table 2 and 3 are already linked, why repeat the data? The very purpose of a relational database is to use the relationships to your advantage! Regardless, if you are still intent on re-populating the data, what you'd want to do is open Table2's recordset, find the record per your dropdown's value, and use the data in said record to alter the values of the textboxes .. I'd also make those textboxes hidden, since you wouldn't want a user to mess with them (or if you want them to see them, at least lock them :) )

regards
 
Back
Top