Saving after each change

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi - I have a bound continuous form with many textboxes for data input.
Currently, the record is saved only when I go to a new record. What is the
best way to get the record saved after each entry? This form is synchronized
with another form that I monitor. It would help if this 2nd form updated
'continuously'.
 
Save record after each entry in form
---

Hi Cinnie,

make this procedure in a general module:

'~~~~~~~~~~~
Function SaveTheForm(pForm As Form)
If pForm.Dirty Then pForm.Dirty = False
DoEvents
End Function
'~~~~~~~~~~~

then, in the AfterUpdate event of each control you want to save after:
=SaveTheForm([Form])

this will update the form you are on. If you want to then update
another form too, then, instead, put this code behind your form:

'~~~~~~~~~~~
Private Function SaveMe()
If Me.Dirty Then Me.Dirty = False
forms!formname.Refresh
DoEvents
End Function
'~~~~~~~~~~~

where formname is the other form you want to be refreshed

then, in each control AfterUpdate property:
=SaveMe()


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
you're welcome, Cinnie ;)

actually, the SaveMe code should be like this:

'~~~~~~~~~~~~~
Private Function SaveMe()
If Me.Dirty Then
Me.Dirty = False
forms!formname.Refresh
DoEvents
end if
End Function
'~~~~~~~~~~~~~

on the AfterUpdate event of a control, of course the form will be Dirty
(changes made but not saved), but I always test for this in a generic
routine because, if you try to save and it doesn't need to be saved, you
will get an error :(


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
Back
Top