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

Is it possible to lock portions of a table?

I have a form that stats are put into. I was wondering if it was possible to lock portions of that table attached to the form to prevent changes to previous months stats but still be able to view them and still be able to add/edit "this months" stats? I've almost debated on just separating the stats info into different tables if that would be easier. Any thoughts?
Jun 19 '10 #1
9 1768
ADezii
8,834 Expert 8TB
@RTaylor1853
Couldn't you simply Lock the Control on the Form that displays the Previous Month's Stats?
Jun 19 '10 #2
If that's done though, would you still be able to add stats for the current month? All stats are in the same table, use the same form.
Jun 19 '10 #3
NeoPa
32,556 Expert Mod 16PB
Your code could determine which is currently in there and set the status depending on whether it's historical or recent. Bear in mind this won't work for multiple-record type forms (See Why Values in Unbound Form Controls do not Persist).
Jun 19 '10 #4
@NeoPa
Well then, that's out of the quetsion.
Jun 20 '10 #5
NeoPa
32,556 Expert Mod 16PB
OK. I'll play.

Does that mean you're using a continuous form?

It's generally easier if you just say what you need to though ;)
Jun 20 '10 #6
jimatqsi
1,271 Expert 1GB
I would handle it like this, whether your form is continuous or single record: I would add an OnEnter event handler for every text box in the detail. In each OnEnter routine I would simply have Call LockOut. The LockOut routine would say:
Expand|Select|Wrap|Line Numbers
  1. ' prevent data changes unles the transaction is this month
  2. If month(me!transactiondate)=month(Date()) then
  3.  me!txtField1.locked = false
  4.  me!txtField2.locked = false
  5.  ....
  6. else
  7.   me!txtField1.locked = true
  8.   me!txtField2.locked = true
  9.  ...
  10. endif
You might even get fancy and change the background colors to indicate those lines that can be edited or not. I like white for can be edited and the minty green color for cannot be edited (me!txtField1.backcolor=xyz). :)

Jim
Jun 21 '10 #7
FishVal
2,653 Expert 2GB
You might even get fancy and change the background colors to indicate those lines that can be edited or not. I like white for can be edited and the minty green color for cannot be edited (me!txtField1.backcolor=xyz). :)
For a form in Datasheet or Continuos view it could be done only via conditional formatting which requires an additional field in the table indicating whether the record is locked or not.

Regards,
Fish
Jun 21 '10 #8
jimatqsi
1,271 Expert 1GB
@FishVal
Ah, you may be right about it requiring conditional formatting, I didn't realize that. But why would it require an additional field to indicate the locked status? The condition within the conditional formatting can still be a comparison of a data item on the row to the current date, or some other thing. It could be dynamic like that, it would not have to rely on a preset value in a lock flag. The preset value would be the date of the activity.

Jim
Jun 21 '10 #9
FishVal
2,653 Expert 2GB
@jimatqsi
Ah well. I've overlooked that there is already a field ([transactiondate]) indicating record lock state. Additional field is certainly not needed.
Jun 23 '10 #10

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

Similar topics

0
by: QWERTY | last post by:
--------------Boundary-00=_O5I3QL80000000000000 Content-Type: Multipart/Alternative; boundary="------------Boundary-00=_O5I3LVC0000000000000" --------------Boundary-00=_O5I3LVC0000000000000...
2
by: G.W. Lucas | last post by:
I apologize if this is a RTFM question, but I have not been able to find a definitive answer elsewhere. Does a "REINDEX TABLE" lock the table while it is working? Can applications write data to...
0
by: Norm Davis | last post by:
Greetings All Environment is Access 2000, multi-user application with back end Access MDB on the server. I lock my Counters table while retrieving the next unique counter with the following...
4
by: deko | last post by:
I'm trying to import an Excel Spreadsheet into an Access Table but sometimes things get buttered up if the spreadsheet does not have the right columns. So I want to drop the Access table and...
1
by: Joseph Shraibman | last post by:
Does ALTER TABLE <table> ALTER <field> SET STATISTICS 100; lock the table? I just tried to do that while a query is running and the ALTER is hanging. ---------------------------(end of...
3
by: equalive | last post by:
Hi guys, I'm having problem locking a table in Ms Access using VB6 code. Actually I have 3 tables. Assume table names is A, B, C. Following is the process. 1. Open table A and update table...
2
by: adri4n | last post by:
as wat ive mentioned in the title.. im would like to know whether the a particular record/table is being locked in my program. some of the methods which i would like to develop are as below: ...
11
by: Tim Hunter | last post by:
Hi I am using WinXP and Access 2003 Is it possible to store the field names of a table in an array and then loop through the array and update the table using the field names stored in the array? I...
5
by: sticky | last post by:
Hi I need to be able to lock a table against INSERT and UPDATE, but not SELECT, for the duration of a transaction. The transaction will be defined at the application level in c#, and then use...
3
by: BUmed | last post by:
OK I know that you are never to allow people access to tables. So just to get it out of the way my boss want to do his own quires and I told him not to but.... In order to minimize potential harm is...
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...
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:
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
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.