Allowedits vs unbound controls

D

dymondjack

TIA

I'm in process of setting up some security features for forms in my db.
I've got a public function that handles the opening of forms and sets
particular properties/formats based on the current user.

The three most important properties that I am setting is the forms
AllowEdits, AllowAdditions and AllowDeletions. This (until now) has worked
out great.

I've got an unbound control at the top of my form (hctlGo) that allows a
user to type an ID of some sort (part number, document id etc) to jump to
that particular record, but the problem I've come up with is that if
AllowEdits is set to False, the user cannot type the ID into hctlGo.

Is there a way to allow text entry on this control in particular, while not
effect the more global AllowEdits?

I suppose I could always disregard the AllowEdits and set each control to
disabled if required, but that takes my simple solution and turns it into a
coding nightmare to maintain the format of the controls (I'm not a particular
fan of having all controls 'greyed' when disabled).

If this was only for one form, it wouldn't be too much of an issue, but it
was my intention to set this as a default for all of my 'standard' forms.

Any thoughts? Thanks again

--
Jack Leach
www.tristatemachine.com

- "A designer knows he has reached perfection not when there is nothing left
to add, but when there is nothing left to take away." - Antoine De Saint
Exupery
 
A

Allen Browne

As you found setting a form's AllowEdits to No affects unbound controls as
well.

Set the Locked property of the controls instead. Your code would need to
look all controls, or unlock those applicable to the current user.

For an example of code that loops through all controls on a form to set the
Locked property of each (handling subforms recursively), see:
Locking bound controls on a form and subforms
at:
http://allenbrowne.com/ser-56.html

(The example does not set the Locked property per user.)
 
D

dymondjack

Allen Browne is THE MAN.

Thanks so much, this was exactly what I was hoping to avoid having to write
myself (I'm not the best with working with controls like this and wasn't
looking forward to the the task).

Many many thanks... you just saved me hours upon hours.
--
Jack Leach
www.tristatemachine.com

- "A designer knows he has reached perfection not when there is nothing left
to add, but when there is nothing left to take away." - Antoine De Saint
Exupery
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top