In MS access, i am using an update query, which runs when i enter data into a form.
the update query WORKS (updates the desired table), but only when i close the form, open it again, and enter a NEW value. it then updates to the old value i typed in.
if i re-open it again, and type in a new value again, it will update the table to the second value i entered... and so fourth
(ie. it only updates when i re-open the form and type in a new value, in which case it updates to the the value i entered the time before.)
in the UPDATE query, i am using the DSum function multiple times, to update about 6 different fields.
this is the query:
UPDATE tblPlayer SET tblPlayer.goals = DSum("[goals]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.shots = DSum("[shots_on_goal]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.assists = DSum("[assists]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.penalties = DSum("[penalties]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.mvp_points = DSum("[mvp_points]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]")
WHERE (((tblPlayer.name)=[Forms]![editplayermatch]![txtname]));
(the database is for a hockey league for ur information
so, all i want to fix, is the way it updates. i want it to update correctly WHEN i enter the value into the form.
any help is much appreciated!
the update query WORKS (updates the desired table), but only when i close the form, open it again, and enter a NEW value. it then updates to the old value i typed in.
if i re-open it again, and type in a new value again, it will update the table to the second value i entered... and so fourth
(ie. it only updates when i re-open the form and type in a new value, in which case it updates to the the value i entered the time before.)
in the UPDATE query, i am using the DSum function multiple times, to update about 6 different fields.
this is the query:
UPDATE tblPlayer SET tblPlayer.goals = DSum("[goals]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.shots = DSum("[shots_on_goal]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.assists = DSum("[assists]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.penalties = DSum("[penalties]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]"), tblPlayer.mvp_points = DSum("[mvp_points]","tblPlayerMatchStats","[name]=Forms![editplayermatch]![txtname]")
WHERE (((tblPlayer.name)=[Forms]![editplayermatch]![txtname]));
(the database is for a hockey league for ur information
so, all i want to fix, is the way it updates. i want it to update correctly WHEN i enter the value into the form.
any help is much appreciated!