473,671 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to lock a field in a record or make it read only in Access 2007

4 New Member
Hello,

The codes below worked successfully in Access 2003
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.   If Me.NewRecord Then
  3.     Me.AllowAdditions = True
  4.     Me.AllowDeletions = True
  5.     Me.AllowEdits = True
  6. Else
  7.     Me.AllowAdditions = True
  8.     Me.AllowDeletions = False
  9.     Me.AllowEdits = False
  10. End If
and
Expand|Select|Wrap|Line Numbers
  1. Sub cmdEdit_Click 
  2. On Error GoTo Err_cmdEdit_Click 
  3.  
  4.    Me.AllowEdits = True 
  5.  
  6. Exit_cmdEdit_Click: 
  7.     Exit Sub 
  8.  
  9. Err_cmdEdit_Click: 
  10.     MsgBox Err.Description 
  11.     Resume Exit_cmdEdit_Click 
  12.  
  13. End sub
It works successfully in Access 2003 but it doesnt work in Access 2007. Please help
Oct 24 '09 #1
4 3733
ChipR
1,287 Recognized Expert Top Contributor
I think I remember having a problem with this. I ended up locking/disabling each of the relevant controls.
Oct 26 '09 #2
NeoPa
32,569 Recognized Expert Moderator MVP
Can you please expand on :
@sweetfalguni
Does it give an error message?
If so what?
Which line does it fail on?
Oct 26 '09 #3
Megalog
378 Recognized Expert Contributor
If this has been converted to a Split Form after your 2007 upgrade, it may not work.
You'll have to replace the "Me." with "[Forms]![formname]."

If not, then... I'm not sure =)
Oct 27 '09 #4
ChipR
1,287 Recognized Expert Top Contributor
In my experience, there was no error message. AllowEdits = False just seems to have no effect.
Oct 27 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2936
by: Mr. M.J. Lush | last post by:
I'm writing a postgres database with a PHP front end for a small work-group , and I want to prevent two editors working on the same record at the same time overwriting each others entry's. The standard solution is to add a lock field to the database and toggle it from 0 (unlocked) to 1 (locked) when the record is selected for editing, however I cannot guarantee that a record will get unlocked when an editor has finished with it (a...
1
3595
by: xixi | last post by:
hi, we are using db2 udb v8.1 ESE with type 4 jcc driver. since DB2 can't support pessimistic locking , and our application required that, which means when both users try to access the same record with intent to update, the first one grab the record will create a row lock on the current row reading, before it update, other user can't access the same record with intent for update read, but can access with read only type. so when the first...
10
2748
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued at -1 and 0 respectively. Unless I specifically set the table field's defaultvalue to Null, the form comes up with an automatic value of 0 in the control? The control has NO default value property setting. Why is that?
0
17776
by: Nashat Wanly | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaskdr/html/askgui06032003.asp Don't Lock Type Objects! Why Lock(typeof(ClassName)) or SyncLock GetType(ClassName) Is Bad Rico Mariani, performance architect for the Microsoft® .NET runtime and longtime Microsoft developer, mentioned to Dr. GUI in an e-mail conversation recently that a fairly common practice (and one that's, unfortunately, described in some of our...
94
30278
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock Statement (C# Reference) statement to serialize access. " But when is it better to use "volatile" instead of "lock" ?
3
3057
by: shorti | last post by:
Hello all, I am running with DB2 UDB V8 on AIX. I am trying to track down what appears to be a lock issue. I turned EVENT MONITOR on with all the options. It doesnt give me the detailed information I need for tracking who is holding the lock. Here is what I get in the event monitor: ------------------------------------------------------------------------
2
2600
by: austris | last post by:
Hi, It's single user .mdb (for now). i've created a generic form for a user to add a note to existing note in a memo Note field in a table (myTbl). The relevant part of the code: ' NoteText = ExsntNote & Chr(13) & Chr(10) & Date & " (" & GetUserName & ") " & NoteText
5
3176
by: prakashwadhwani | last post by:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in my form were working perfectly. However, after I added a call to the "Save_Fields_In_Form_Header" Event/Proc in the "Current" Event of my form, and I now try to Delete a record, I get ... Run-Time Error 3218 - Could not Update; Currently Locked. My Access application then effectively freezes forcing me to shut Access down & re-start. The record DOES get deleted...
25
14839
by: zmickle | last post by:
Excuse my noobness. I am managing an access database that is shared by 4 users. Management does not want to use any technologies outside of access for this application (no SQL Server, etc). I have split the database into front end and back end databases and put the front end on each of the users' computers. All users can open the front end simultaneously, but once somebody updates data in the form, the back end locks up. What I...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8596
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6222
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.