How to set textbox.enable = true in another form? (1 Viewer)

dimand.sok

New member
Local time
Today, 15:55
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
 

DCrake

Remembered
Local time
Today, 09:55
Joined
Jun 8, 2005
Messages
8,632
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?
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 18:55
Joined
Jan 20, 2009
Messages
12,852
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.
 

seopositive2

New member
Local time
Today, 01:55
Joined
May 29, 2009
Messages
9
<script language="javascript">

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

</script>

<a href="javascript:enableField()">Click here to enable the element<a/>
 

dimand.sok

New member
Local time
Today, 15:55
Joined
May 29, 2009
Messages
3
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.
 

dimand.sok

New member
Local time
Today, 15:55
Joined
May 29, 2009
Messages
3
I want to give the right for user, some user will not allow to enter my textbox.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 18:55
Joined
Jan 20, 2009
Messages
12,852
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

Top Bottom