function to lock fields

  • Thread starter Thread starter JamesSF
  • Start date Start date
J

JamesSF

i use an lock button on my forms to lock fields with

..allowedits = false

this is cumbersome as i need to manually in code list each field and
disallow edits. then make a unlock button to set value to true.

can some one air code a function where i can pass the form name and have it
iterate through all fields (text, combo, radio, check boxes) on that form
and apply the .allowedits = false or .allowedits = true?

also, what about subforms as well? would need to lock all fields on each
subform as well

Thanks in advance
JamesSF
 
If you are trying to lock the entire form why cant you
just do something like this?

Forms("form1").AllowEdits = False

Or if you wanted to make a button that switches between
locking and unlocking the form something like this.

Forms("form1").AllowEdits = not Forms("form1").AllowEdits

Robert
 
hmm couple things come to mind

will locking the form lock subforms as well?

ititially, i wanted to only lock some fields and keep others unlocked.
locking the form does not allow you to go back and just unlock 1 or 2
fields. however, this function would lock them all then i would just need
to back track 1 or 2 field and specifically keep them unlocked at all times.

also, i wanted a module i could call anywhere in the app - not just a custom
lock line on each form

Thanks
JamesSF
 
Back
Top