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

Changing field values through a button

Status
Not open for further replies.

FurryGorilla

Technical User
Apr 11, 2001
76
GB
I want to update a table, named CLAIM which has 2 fields, Form_num and RetentionDate, based on a form.

The form_num is a foreign key in another table called CLAIMED which also holds an eartag_num.

I have used two text boxes on the form holding these attributes and a combo box to select the eartag number which will be inserted into the CLAIMED table.

I have then got a button which inserts the appropriate values into the CLAIMED table. Unfortunately I have been unable to update the CLAIM table with the RetentionDate from the form due to integrity constraints on the primary key. The SQL I have used for this is as follows:

UPDATE CLAIM SET RetentionDate = [Forms]![BULL PREMIUM]![RetentionDate]
WHERE CLAIM.Form_num = [Forms]![BULL PREMIUM]![Form_num];

I have tried using an INSERT query but this is also incorrect. Could anyone shed any light on how to solve this problem?

Also when I refresh the form the combo box has the last value selected still in it, even though the selection has been removed from the list. Is there a way of replacing this with a caption, such as "Select eartag number"?

Many thanks
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top