423,850 Members | 1,661 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,850 IT Pros & Developers. It's quick & easy.

Locking single records in a data entry form

P: 64
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 criteria box. The trick is that I want the user to see all the records according to the criteria box but I don't want the user to be able to edit the existing records but still have the ability to enter new records. I have added a "locked yes/no box in the table to try and key off of but I can't come up with the code to lock a single record.

I hope this makes sense.

Thanks

-Tom
Nov 27 '07 #1
Share this Question
Share on Google+
9 Replies


JustJim
Expert 100+
P: 407
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 criteria box. The trick is that I want the user to see all the records according to the criteria box but I don't want the user to be able to edit the existing records but still have the ability to enter new records. I have added a "locked yes/no box in the table to try and key off of but I can't come up with the code to lock a single record.

I hope this makes sense.

Thanks

-Tom
Hi Tom
If you look at the Data tab of the Properties sheet for your data entry form (open the form in design view and click on the properties button on the toolbar) you will see some properties called "Allow Edits", "Allow Deletions" and "Allow Additions".

Make "Allow Edits" = No and "Allow Additions" = Yes and I think you will have what you want.

Jim
Nov 28 '07 #2

P: 64
Hi Tom
If you look at the Data tab of the Properties sheet for your data entry form (open the form in design view and click on the properties button on the toolbar) you will see some properties called "Allow Edits", "Allow Deletions" and "Allow Additions".

Make "Allow Edits" = No and "Allow Additions" = Yes and I think you will have what you want.

Jim
Jim,

Thanks

I stumbled across that combination yesterday.

It works...almost.

What I am trying to do is lock specific records from being edited. In other words, once an emplyee enters a time card record, after a certain time of day, I want to lock that record from being edited, assuming one can't get to the tables directly, which I have in a separate folder. I have a "time modified" box which tells me date/time of new record and or record edit. I want to be able to lock a record down for "no edit" after a certain date/time stamp. Am I asking too much?

Thanks

-Tom
Nov 29 '07 #3

P: 64
Jim,

Thanks

I stumbled across that combination yesterday.

It works...almost.

What I am trying to do is lock specific records from being edited. In other words, once an emplyee enters a time card record, after a certain time of day, I want to lock that record from being edited, assuming one can't get to the tables directly, which I have in a separate folder. I have a "time modified" box which tells me date/time of new record and or record edit. I want to be able to lock a record down for "no edit" after a certain date/time stamp. Am I asking too much?

Thanks

-Tom
Nov 29 '07 #4

JustJim
Expert 100+
P: 407
Jim,

Thanks

I stumbled across that combination yesterday.

It works...almost.

What I am trying to do is lock specific records from being edited. In other words, once an emplyee enters a time card record, after a certain time of day, I want to lock that record from being edited, assuming one can't get to the tables directly, which I have in a separate folder. I have a "time modified" box which tells me date/time of new record and or record edit. I want to be able to lock a record down for "no edit" after a certain date/time stamp. Am I asking too much?

Thanks

-Tom
I think you're going to have to move to a single form implementation and, using your check box value as a trigger, set either the "Visible", "Locked" or "Enabled" properties of particular controls on the form.

Jim
Nov 30 '07 #5

P: 64
I think you're going to have to move to a single form implementation and, using your check box value as a trigger, set either the "Visible", "Locked" or "Enabled" properties of particular controls on the form.

Jim
Jim thanks for your reply.

So..if an employee wants to look at a range of records, I should just create a report? That just createds an extra step for them. There is no way to lock a single record other than through the "locked" properties on a control. And of course as you know, when using continuous forms, this locks those controls when adding a new record. Is it possible to lock a record from edit at the table level?
Thanks

-Tom
Nov 30 '07 #6

JustJim
Expert 100+
P: 407
Jim thanks for your reply.

So..if an employee wants to look at a range of records, I should just create a report? That just createds an extra step for them. There is no way to lock a single record other than through the "locked" properties on a control. And of course as you know, when using continuous forms, this locks those controls when adding a new record. Is it possible to lock a record from edit at the table level?
Thanks

-Tom
Well, if you're determined to use continuous forms, you need to make it so that only records that you want to be able to be edited are displayed. (what a convoluted sentence!). You could move the secured records right out of the table and into another table (not the way I'd go) or you could use a filter or query to make sure the form's recordset only has records you want to allow editing on. Your "locking" field would be ideal for this purpose.

I doubt you could lock a record at the table design level since at that level you are not looking at individual records, but at the fields which will make up the records.

Jim
Dec 2 '07 #7

P: 64
Thanks...

I knew I was overlooking the obvious. I created a qry that locks records bast a certain date/time and then created two continous but identical forms...one read only, which includes locked records and one for editing which shows only unlocked records.

Thanks

-Tom
Dec 3 '07 #8

Expert 100+
P: 446
Thanks...

I knew I was overlooking the obvious. I created a qry that locks records bast a certain date/time and then created two continous but identical forms...one read only, which includes locked records and one for editing which shows only unlocked records.

Thanks

-Tom
Sounds like you have a solution but if you wanted only one form you might call a check_locked() Sub in the On_Enter of each field they may be tempted to edit.

The Sub would need a test (If . . Then ) for if the data should be locked and a message box, else unlock it
e.g

Expand|Select|Wrap|Line Numbers
  1. Private Sub check_locked()
  2.  
  3. If 'lock condition = true' Then
  4.        Msgbox "Data Locked"
  5.        Me.Field1.Locked = True
  6.        Me.Field2.Locked = True
  7.        .
  8.       .
  9. Else
  10.        Me.Field1.Locked = False
  11.        Me.Field2.Locked = False
  12.        .
  13.        .
  14. EndIf
  15.  
  16. End Sub
Best of lock !!
Dec 3 '07 #9

P: 1
@sierra7
Thanks. This will meet my needs perfectly.
3 Weeks Ago #10

Post your reply

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