Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change edition property in a form?

Status
Not open for further replies.

taliz

Technical User
Jun 3, 2003
4
PA
Hello!!

I want to know if it’s possible to change the form properties (allow editions) in the data tab properties to “yes” by using a code. My form is set to “no”, it is ok for simple users, but I want to permit the edition to special users, who must introduce a password. If the password is correct, then the edition property will change to “yes”.

Any idea?




 
Hi,

You should be able to use:

Me.AllowEdits = True
Me.AllowAdditions = True

Dean :)
 
Taliz,

To get a password you'll need something like this.

Dim response As String
Dim password As String
password = "password"
response = InputBox("Enter in a password to edit field")
If response = password Then
"FormName"."fieldname".Enabled = False
'(this allows just a particular field in the form to not be edited. Use Dean's suggestion if you want to enable or disable the entire form.)
Else
"FormName"."fieldname".Enabled = True
End If

Where it says "FormName" and "Fieldname" you'll need to change that so that it applies to your form and fieldname. You'll want to place this code on the form properties "On Open"

Hope this helps.

ken
 
Thank's a lot,

I wanted to enable or disable the entire form, so I used both suggestions.
It work`s good, but I have a subform into my form and it's always enable. How can I change it?

Is it possible to set the password format (****) in the InputBox?

[thumbsup2]
 
to disable the subform enter in

subformname.allowedits = false

As for your password format to **** that's not possible as an input box. You'll need to create a form within vb and set the textbox property within your form to password character.

Hope that helps.

ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top