Jumat, 01 Juni 2012

[MS_AccessPros] Re: Preventing moving to next record with a dirty form

 

Hi Lee,

You put the code in the Form's BeforUpdate Event.
Something along the lines of,

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo MyErr
If vbYes = MsgBox("Save Record? Yes/No/Cancel", vbYesNoCancel + vbDefaultButton3, "Save Record") Then
DoCmd.Save
ElseIf vbNo Then
Me.Undo
Else
Cancel = True
End If
MyExit:
Exit Sub
MyErr:
MsgBox "Err = " & Err & vbCrLf & Err.Description
Resume MyExit
End Sub

Hope that helps.

Regards, Clive.

--- In MS_Access_Professionals@yahoogroups.com, "Lee" <leevt99@...> wrote:
>
> Right, I'm trying to prevent them from navigating away without saving. I just don't know where to put the dirty check to accomplish that.
>
> --- In MS_Access_Professionals@yahoogroups.com, "Glenn Lloyd" <argeedblu@> wrote:
> >
> > Lee,
> >
> >
> >
> > Unless you have something in place that would prevent saving the data, it is
> > saved by default as soon as the user navigates away from the record.
> >
> >
> >
> > Glenn
> >
> >
> >
> >
> >
> >
> >
> > From: MS_Access_Professionals@yahoogroups.com
> > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Lee
> > Sent: June-01-12 1:27 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > Subject: [MS_AccessPros] Preventing moving to next record with a dirty form
> >
> >
> >
> >
> >
> > Hi,
> > I have a bound form that shows 1 record at a time. I use the default access
> > (03) navigation buttons at the bottom of the form allow the user to switch
> > between records. I'm trying to make it so if a user makes changes to 1
> > record and then tries to move to another record without saving, they will be
> > prompted to save first, but I can't figure out which event to put "dirty"
> > check in.
> >
> > Thanks
> > -Lee
> >
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar