473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Locking Records in Forms

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
1 1181
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ryan | last post by:
I have a problem with record locking / blocking within an application. The app is quite straight forward. Written in Delphi 5 using BDE to access a SQL 7 database (Win2K server). Every so often...
3
by: Joe | last post by:
Hi there, question regarding Access 2000 - locking records: I want to be able to lock a record (or several records) on a form so that particular record can not be edited until I undo the lock (im...
1
by: Simon | last post by:
Dear reader, In case I work with two Forms and using the same Table but with other fields in the Forms, I have the following experience. After I change in one of the two Forms a field I can't...
6
by: MS | last post by:
Access 97 here. I want a simple way to "lock" certain records on a form. Some records remain "live" until all data is available which happens over time. When all the fields are complete, I want...
0
by: brijeshmathew | last post by:
Hi I use Visual Basic 6, Service Pack 6, Microsoft ActiveX Data Objects 2.8 Library(msado15.dll) and access 2000 database using JET 4 OLE. I have an application that adds records simultaneously...
3
by: jamesgrady via AccessMonster.com | last post by:
Guys, I created a database about 2 years ago with about 30 tables and 60 queries, with a bunch of forms, and macros, and a whole heap of a lot of VB code. It was worked excellent until...
9
by: master | last post by:
Actually, it is not only the record locking, what I need, and nobody seems to descibe this. Imagine the following scenario. There is a database with, say 10000 records with some unvalidated...
6
by: Trees | last post by:
I have a database that was created so that 4 separate shops could go in and enter pertinent information about how their shops ran throughout the day so that my boss (and theirs) could report out...
9
by: tbeers | last post by:
I apologize for what is probably a simple solution. I have a data entry form that I use to enter work times. I have the default view set to "continuos forms" and the form is enter through a...
1
by: ABrown | last post by:
Hello, I have a 2003 database set up with about 20 users (only about 4 at a time) but I repeatedly get a problem with the records all locking. Each User is assigning billing codes to jobs so they...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.