updating record via form

cyberpac9

Registered User.
Local time
Today, 13:24
Joined
Jun 6, 2005
Messages
70
on my form i have a few radio buttons, check boxes, text fields and combo boxes. i am able to change and update all fields except combo boxes. it modifies the wrong table...
Code:
combo_table
------------
id     value
1      house
2      school
3      work
if on my form the combo box for a specific record shows house selected, the value of 1 (the id from combo_table) should be the value put in the main talbe...if this is changed to option 2, school, the main table should have 2 in that field...

what happens though, is if i change from 1 (house) to 2 (school) combo_table ends up looking like the following:
Code:
combo_table
------------
id     value
1      house
2      house
3      work
 
Have a look at the attached sample, in the form frmEmployeeAddEdit have a look (in design view) at the combo box cboJobTitle you will see that its row source is a query based on table tblJobTitle and that the control source is fkJobTitle ( that mean that the primary key from the table tblJobTitle is saved in the table tblEmployees in the fkJobTitle field.

Now open up the query qryEmployees in design view and see how the keys are linked to return the text of the job title instead of the fkJobTitle.

I hope you can follow this and get it to work for you. Post back if you have further questions.
 

Attachments

ansentry said:
Have a look at the attached sample, in the form frmEmployeeAddEdit have a look (in design view) at the combo box cboJobTitle you will see that its row source is a query based on table tblJobTitle and that the control source is fkJobTitle ( that mean that the primary key from the table tblJobTitle is saved in the table tblEmployees in the fkJobTitle field.

Now open up the query qryEmployees in design view and see how the keys are linked to return the text of the job title instead of the fkJobTitle.

I hope you can follow this and get it to work for you. Post back if you have further questions.
John -
sorry for the delay, i've been out of the office...i'll give that a look and compare to my setup and report back...

thanks!
 
John:

whew, we had an emergency and i've been out...i looked at your example but there is one major difference between your example and my form: my form is based on a query, and yours is based on a table...

the way the form works is when it is loaded it asks for a Building# (as a filter, essentially) and then it returns information from about 5 tables:
  1. main table
  2. combo table 1
  3. combo table 2
  4. combo table 3
  5. combo table 4
when i try to update one of the combo boxes on the form (with the records for the combo box coming from one of the combo tables) it doesn't update the corresponding main table's foreign key...

i have fixed the original issue but now if i change the value on the form from house to school, close the form and open it again, it never changed...it is still house...(look at original post to see what i'm referring to)...

any suggestions?
 
nevermind...i'm an idiot....i should only modify one thing at a time so as to not confuse me...it works now...thanks for your assistance...
 

Users who are viewing this thread

Back
Top Bottom