"On Current" property question

Hmm, so vbaInet really does sleep! :D

In his (making BIG assumption) absence... It appears you only want to lock specific fields and only after they have been edited. This should work...

http://regina-whipp.com/blog/?p=663 (See item 3)
 
So I tried different variations of the info from the blog Gina. I've attached the text I pulled from the website. Also attached is jpg of the error message I got; and then the jpg of the code. Any thoughts on where I went wrong?
 

Attachments

  • Run-time error 438.JPG
    Run-time error 438.JPG
    66.6 KB · Views: 84
  • ctl.Locked.JPG
    ctl.Locked.JPG
    81.5 KB · Views: 81
  • Tag-3.txt
    Tag-3.txt
    701 bytes · Views: 80
First thing... it appears the quotation marks pasted *funny*. Please go and remove and then retype, then try again...
 
I see what you mean. I retyped and I no longer get the error message. However, I am still able to edit the field?
 
Using some rabbit trails from your blog I got to a site that said this:

If the user updates the field, you could have it in the after update event
so that it locks the field like this:

me.FIELDNAME.locked = true

If you never want people to be able to edit data in any field, you could set
AllowEdits to False for the form.

If it's random fields, remember to also check in the On Current event
whether the fields should be enabled or not...

I tried this in one field and it appears to be working. I'm going to play around with this some more to see if it will work everywhere I need it to. Thank you.
 
NOPE! Not working. I can't enter any data in that field in the next record . . .

I am open to ideas!!
 
Oh wait. It may work. I put the above code in the FORM after update field. I'm now putting it in the field.
 
DId you add the term LockMe to the all Control's Tag Property on the Form that you want to lock?
 
Sipping my coffee, waiting to hear if you got it worked out...
 
No. I had it in the control. I just put it in the form. A question - how do I enter it?
"LockMe"
LockMe
Lock Me
 
LockMe

And it goes in the Tag Property of the Control located in the Properties window for said Control.
 
Ok, I did that now.

It works only the first time the form is opened, then when I move between records it is editable.
 
The code only locks new records, did you also want to lock records with data? What did I miss? :confused:
 
I am apparently not very good at explaining . . . but here goes.
The form is based on a query that shows all records where the Lid return date is "null" or the Tote return is null. A tote(s) and a lid(s) always go out and they are on 1 transaction. But either/or may not come back at the same time. Then the form is opened again to enter the info at a later date (for the tote or lid that is finally returned).
 
Could be me not understanding :o

When and under what circumstances do you want the Form Control locked? Do you want them all locked or only certain ones?
 
I want the fields locked after data has been entered in the field. It could be any one of four different fields at any time.
 
Last edited:
Edit
One field could be entered today (lock the field), then another field could be entered in 2 weeks (lock that field)
 
Okay, so anytime a field gets data entered into it and then the User exits you want the field locked. What do you want to do about edits? (Just want to make sure I point you in the right direction.)
 

Users who are viewing this thread

Back
Top Bottom