Record goes into Edit Mode ?

D

Dave Elliott

My record goes into edit mode when the below code fires. It does not save ?
I dont think it should even have to save, dont understand!

If ([Flag]) = True Then
MsgBox "Flagged Record, Please Check Notes"
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSaveRecord
End If
 
G

Guest

When is the code executed, and to what end?
A record is saved when you navigate away from the record, or when the record
is explicitly saved. Off hand I can't see the point of: DoCmd.RunCommand
acCmdSelectRecord, but I also wonder why you need to explicitly save the
record.
 
D

Dave Elliott

The code is fired on the on current event of the main form.
Save code is to try and make it not be in the edit mode.
 
G

Guest

As soon as you go to a new record the Current event will run. I have never
tried to save a record before putting something into it, but the lack of data
could be a problem. What do you mean "make it not be in the edit mode"?
Please post the full thread when you reply so that it is not necessary to
flip between messages to see the progress.
 
D

Dave Elliott

I mean it is the pencil mode on the taskbar and not saved yet even though I
am not changing anything.
dont know how to pull the full thread, sorry!

Outook giving me some problems anyway!
 
L

Larry Linson

If you are using a bound Form, whether or not the Record is editable is
controlled by Properties of the Form: Allow Edits, Allow Deletions, Allow
Additions, and/or Data Entry. It will automatically be saved, if any changes
have been made, when you move off the Form, move to another Record, move to
a Subform Control on the Form, or Close the Form. If you do NOT want it
saved, you have to intercept in the BeforeUpdate event and Cancel the
Update.

The OnCurrent event fires as soon as you move to a different Record -- 'way
too early to need to save (that is, it fires before the user could enter any
data, and whatever is in the Record, by defintion, is already saved).

If you are asking us whether it saves or not, well, yes, what you show
should save it, but it only saves whatever is already saved.

[Flag] could be a Field in the RecordSource of the Form, or it could be a
Control on the Form. From what you show, we can't determine which.

Perhaps you could clarify what you have and what you are trying to do, and
the exact effect of what you do, when you do it, and what your question is.

Larry Linson
Microsoft Access MVP
 
D

Dave Elliott

Ok here goes with more explanation; I dont want the form to go into the edit
mode, i.e. pencil mode when the code fires checking if Flag is true or not
and this is what happens now. I know it will save if move to another record
or close but I dont want it to be in edit mode at all simply because the
code is checking if Flag is true or not!

when Flag is true the record goes into pencil or edit mode, I dont want this
to happen.
 

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