473,385 Members | 1,606 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,385 software developers and data experts.

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

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 3717
ChipR
1,287 Expert 1GB
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,556 Expert Mod 16PB
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 Expert 256MB
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 Expert 1GB
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
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...
1
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...
10
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...
0
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...
94
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...
3
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...
2
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...
5
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...
25
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.