473,397 Members | 2,084 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 a Form

Im creating a database for a stock contol system. I would like to lock each record in a from once it has been stored but still be able to enter new records without pressing anything. I would then like a command button that a user could press to unlock the record in order for them to edit it in form mode.
I would be grateful of any help
Matt
Apr 19 '07 #1
6 1891
nico5038
3,080 Expert 2GB
I use in such a situation a datasheet subform showing all objects and add Action buttons like [Add], [Update], [Delete], [Print], etc for the dataprocessing.
The actionbuttons will show a new form and the Add form could be made repetitive by having a [Save and Add next] button and a [Save and close] button.
Getting the idea ?

Just check this sample .mdb:
http://www.geocities.com/nico5038/xS...tAction-97.zip

Nic;o)
Apr 23 '07 #2
ADezii
8,834 Expert 8TB
Im creating a database for a stock contol system. I would like to lock each record in a from once it has been stored but still be able to enter new records without pressing anything. I would then like a command button that a user could press to unlock the record in order for them to edit it in form mode.
I would be grateful of any help
Matt
Place the following code in the Current() Event of a Form. I'm sure you can figure out the unlock button part from the code also:
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
  11. End Sub
Apr 23 '07 #3
NeoPa
32,556 Expert Mod 16PB
I just changed the title of the thread to make it easier to find in a search.
Apr 24 '07 #4
Place the following code in the Current() Event of a Form. I'm sure you can figure out the unlock button part from the code also:
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
  11. End Sub

I have a similar problem , Could you pls write the code for unlocking the record so I am able to change data so I can save and update the record.
Jul 18 '07 #5
I have a similar problem , Could you pls write the code for unlocking the record so I am able to change data so I can save and update the record.

--------------------------------------------------------------------------------
Jul 18 '07 #6
NeoPa
32,556 Expert Mod 16PB
I have a similar problem , Could you pls write the code for unlocking the record so I am able to change data so I can save and update the record.
If your problem is similar, then the answer already posted should be more than good enough for you.
This is not your thread to change the question, and we do NOT write code to your specification, we try to lead you to write your own code.

What with the tone of your question, the fact that you're hijacking someone else's thread AND using text-speak in your question (I couldn't even find space to include that you double-posted too), you may want to consider doing this one again from scratch.

MODERATOR.
Jul 18 '07 #7

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

Similar topics

16
by: Nid | last post by:
How do I do row-level locking on SQL Server? Thanks, Nid
3
by: Elias Farah | last post by:
Dear Access Peers, I am having a problem over a network, where the Database takes 5-Mins to load instead of the normal 5 seconds. It has only started to do this since I split the frontend &...
0
by: ethanj /personal/ | last post by:
We are using Access 2000 database, with the following settings. Tool > Options > Advance > Default Record Locking = Edited Record Open databases using record level locking = True Form...
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...
5
by: jaking01 | last post by:
Hi. I am currently working on a form that I need to prevent changes to after data has been input. There are a series of tick boxes on the form, and when each one of these is ticked it spawns...
1
by: wheel | last post by:
I have been ok with optimistic locking most of the time but I have a situation now where there is more of a chance that users could try to edit a record at the same time. I'd like to use pessimitic...
10
by: Ami | last post by:
Hello everyone, I have developed a small access application and now I need to lock my forms against unwanted edits. I have used the code by Allen Browne I found here...
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: zmickle | last post by:
Experts and books all say that you can share an Access back end on a shared drive with the front end running on each host computer. I have a simple database that tracks student data and it is...
3
by: kstevens | last post by:
I have turned on record locking do to the fact that we are starting to have issues with the records not being locked. I have a button on a form that changes the recordsource of the form. When i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.