Update Table from Form

M

margaret

I have a very simple table ... tblControlFile and I have a form
frmSwitchboard that has an underlying query qryControlFile. When I change
the date ("fairdate")on frmSwitchboard, it is not changing the date on the
tblControlFile until I exit the form and come back into it. I would like the
date to update the table on exit of the control.

I know this is simple but I can't seem to find the answer in all the posted
questions and would hope some one could help me.
 
A

Arvin Meyer [MVP]

Records do not update until you finish them. You can force an update though
in the AfterUpdate event of the control (untested):

Sub fairdate_AfterUpdate()
DoCmd.RunCommand acCmdSaveRecord
End Sub

This will fail if you have any required fields in the table which haven't
been saved as well.
 
R

ruralguy via AccessMonster.com

Access does not automatically save a record unless you move to another record
or close the form. Try using DoCmd.RunCommand acCmdSaveRecord in the
AfterUpdate event of the control.
 
M

margaret

Thanks so much ... that worked perfectly!!

Arvin Meyer said:
Records do not update until you finish them. You can force an update though
in the AfterUpdate event of the control (untested):

Sub fairdate_AfterUpdate()
DoCmd.RunCommand acCmdSaveRecord
End Sub

This will fail if you have any required fields in the table which haven't
been saved as well.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
Top