By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Locking Records in Forms

P: n/a
Basically, I built in a little confirm button on a form so that if they
type something they don't like, it doesn't automatically update the
table when the form is closed, while updating if that is the proper
change. The problem is, I don't know how to do it. I'm sure that the
solution is blinding simple, but I don't know what it is. Thanks in
advance, and forgive my ignorance.

Jul 24 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
how about something like this?

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim intReply As Integer

intReply = MsgBox("Do you want to keep the changes?", vbYesNo)
If intReply = vbNo Then
Me.Undo
End If

End Sub

Otherwise, if you wanted to force individual records to be locked,
you'd have to add a yes/No field to your table, (I'll call it
"LockThisRecord") and then in the OnCurrent event of the form, set the
AllowEdits property of the form to the value of "LockThisRecord".

Private Sub MyForm_OnCurrent()
me.Locked=not Me.LockThisRecord
End Sub

Hope this helps (at least a little!)

Pieter

Jul 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.