How to set textbox.enable = true in another form?

dimand.sok

New member
Local time
Tomorrow, 06:00
Joined
May 29, 2009
Messages
3
I have two Form, 1- frmmain and it have txttest
2-frmlogin and it have username and password text box.
after I login to frmlogin form correct, then I want to my txttest in frmmain to
enable=true

my code is

docmd.openform "frmmain"
Forms!frmmain!txttest.enable = true

I wrote this code in the login command. but when I run it error,
How can I do that?

Thansk
Dimand
 
If the user cannot access the frmmain until they have entered a correct username and password then why have the need to enable a control. Why is it disabled in the first place?
 
Forms!frmmain!txttest.enable = true
Dimand

The property is called "Enabled". You left off the "d".

Incidentally, DCrake didn't realise you only posted a conceptual code fragment.
Obviously you intend to include some kind of if statement to test the login and enable controls as appropriate for that user.
 
<script language="javascript">

function enableField()
{
document.form1.address2.disabled=false;
}

</script>

<a href="javascript:enableField()">Click here to enable the element<a/>
 
If the user cannot access the frmmain until they have entered a correct username and password then why have the need to enable a control. Why is it disabled in the first place?
what i want to do is, I want to set access right to user, If I have 2 kind of users, one is for admin and other one for user, so some textbox i don't want normal user can access it only admin account can. any idea please let me know.
 
I want to give the right for user, some user will not allow to enter my textbox.
 
what i want to do is, I want to set access right to user, If I have 2 kind of users, one is for admin and other one for user, so some textbox i don't want normal user can access it only admin account can. any idea please let me know.

Make a table of Users. Include fields for UserID and SecurityLevel. A level of 1 might be administrator etc.

Lookup the SecurityLevel of the logged user and enable the textbox if they are at the right level.

If DLookUp("SecurityLevel", "tblUsers", "frmLogin.txtboxUser = tblUsers.UserID") = 1 then: Forms!Formname.thetextbox.enabled = true
 

Users who are viewing this thread

Back
Top Bottom