Commit/Save Record

M

Manuel

I have a form where users enter data. Once the record is edited a picture of
a pencil appears to indicate that the record has been edited. I want to
commit the record to the database/save the record immediately after the
record is edited. How would I do this?

Thanks,

Manuel
 
J

John W. Vinson

I have a form where users enter data. Once the record is edited a picture of
a pencil appears to indicate that the record has been edited. I want to
commit the record to the database/save the record immediately after the
record is edited. How would I do this?

Thanks,

Manuel

What exactly do you mean? The pencil appears the instant the record is
"dirtied" - at the very first keystroke in any bound field in the form. Do you
want the record to be saved when you type "M" in the firstname field, saved
again when you type "a", yet again when you type "n", and so on? If so, why?

Access will automatically save the record when you *leave* the last field in
the tab order, or move to a new record, or close the form (unless of course it
fails validation); is that not adequate?
 
M

Manuel

I have a command button that runs a report and if the user makes a change and
then runs the report immediately afterwards, the change in not captured in
the report. I guess I should have asked how to refresh/requery the report 's
recordset (if that's even the most appropriate course of action).

Thanks for your assistance.

Manuel
 
J

Jeanette Cunningham

The code for the button that runs the report needs to save the form before
the report runs.
So the first line of code for the button should be

If Me.Dirty = True Then
Me.Dirty = False
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

jay

Curious why you need the If statement. Why wouldn't you just put
Me.dirty = False and force a save in any event.

-----Original Message-----
From: Jeanette Cunningham [mailto:[email protected]]
Posted At: Tuesday, April 13, 2010 6:32 PM
Posted To: microsoft.public.access.modulesdaovba
Conversation: Commit/Save Record
Subject: Re: Commit/Save Record


The code for the button that runs the report needs to save the form
before the report runs.
So the first line of code for the button should be

If Me.Dirty = True Then
Me.Dirty = False
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jeanette Cunningham

I always test first to see if it's needed, to stop any before update
validation code running. Why make access go to the trouble of saving if
there's nothing to save?

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia




jay said:
Curious why you need the If statement. Why wouldn't you just put
Me.dirty = False and force a save in any event.

-----Original Message-----
From: Jeanette Cunningham [mailto:[email protected]]
Posted At: Tuesday, April 13, 2010 6:32 PM
Posted To: microsoft.public.access.modulesdaovba
Conversation: Commit/Save Record
Subject: Re: Commit/Save Record


The code for the button that runs the report needs to save the form
before the report runs.
So the first line of code for the button should be

If Me.Dirty = True Then
Me.Dirty = False
End If


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Manuel said:
I have a command button that runs a report and if the user makes a
change and then runs the report immediately afterwards, the change in
not captured in the report. I guess I should have asked how to
refresh/requery the report 's recordset (if that's even the most
appropriate course of action).

Thanks for your assistance.

Manuel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top