FurryGorilla
Technical User
I am trying to add records to a table using a combination of a combo box, text boxes and a single button. The form has 2 text boxes called RetentionDate and Form_num, 1 combo-box which uses a query to list eligible records, and a button to add records. When you select a record from the combo box the primary key is displayed (called Eartag_num). The button then needs to be used to update 3 tables based on the inputted data.
[ol][li] CATTLE table which updates one field with a numerical value of 1.[/li]
[li]CLAIM table which needs to be updated using the RetentionDate and Form_num text boxes from the form.[/li]
[li]CLAIMED table which needs to have the Form_num and Eartag_num added to it.[/li][/ol]The command I have on the form button is as follows:
DoCmd.OpenQuery "qryUpdateBull", acNormal, acEdit
Where qryUpdateBull is the query I wish to run.
The SQL for the qryUpdateBull is as follows:
UPDATE CATTLE, CLAIMED, CLAIM SET CLAIMED.Eartag_num = [Forms]![BULL PREMIUM]![Eartag_num], CLAIMED.Form_num = [Forms]![BULL PREMIUM]![Form_num], CATTLE.NumberPremiums = "1", CLAIM.Form_num = [Forms]![BULL PREMIUM]![Form_num], CLAIM.RetentionDate = [Forms]![BULL PREMIUM]![RetentionDate];
Although Access did come up with the following:
UPDATE CATTLE INNER JOIN (CLAIM INNER JOIN CLAIMED ON CLAIM.Form_num = CLAIMED.Form_num) ON CATTLE.Eartag_num = CLAIMED.Eartag_num SET CLAIMED.Eartag_num = [Forms]![BULL PREMIUM]![Eartag_num], CLAIMED.Form_num = [Forms]![BULL PREMIUM]![Form_num], CATTLE.NumberPremiums = 1, CLAIM.Form_num = [Forms]![BULL PREMIUM]![Form_num], CLAIM.RetentionDate = [Forms]![BULL PREMIUM]![RetentionDate];
Unfortunately when I click on the button no rows are updated and being a novice I’m not entirely sure why.
Thanks in advance,
Chris
[ol][li] CATTLE table which updates one field with a numerical value of 1.[/li]
[li]CLAIM table which needs to be updated using the RetentionDate and Form_num text boxes from the form.[/li]
[li]CLAIMED table which needs to have the Form_num and Eartag_num added to it.[/li][/ol]The command I have on the form button is as follows:
DoCmd.OpenQuery "qryUpdateBull", acNormal, acEdit
Where qryUpdateBull is the query I wish to run.
The SQL for the qryUpdateBull is as follows:
UPDATE CATTLE, CLAIMED, CLAIM SET CLAIMED.Eartag_num = [Forms]![BULL PREMIUM]![Eartag_num], CLAIMED.Form_num = [Forms]![BULL PREMIUM]![Form_num], CATTLE.NumberPremiums = "1", CLAIM.Form_num = [Forms]![BULL PREMIUM]![Form_num], CLAIM.RetentionDate = [Forms]![BULL PREMIUM]![RetentionDate];
Although Access did come up with the following:
UPDATE CATTLE INNER JOIN (CLAIM INNER JOIN CLAIMED ON CLAIM.Form_num = CLAIMED.Form_num) ON CATTLE.Eartag_num = CLAIMED.Eartag_num SET CLAIMED.Eartag_num = [Forms]![BULL PREMIUM]![Eartag_num], CLAIMED.Form_num = [Forms]![BULL PREMIUM]![Form_num], CATTLE.NumberPremiums = 1, CLAIM.Form_num = [Forms]![BULL PREMIUM]![Form_num], CLAIM.RetentionDate = [Forms]![BULL PREMIUM]![RetentionDate];
Unfortunately when I click on the button no rows are updated and being a novice I’m not entirely sure why.
Thanks in advance,
Chris