whats wrong with my code

G

Guest

dear friends,
i have an Open_up form with many command buttons on its header.
form based on a fields
1) loginname
2) password
my code goes like this
private sub form activate ()
if is null(loginname) and isnull(password) then msgbox ("xyz")
if password <> "balu" then msgbox("xyz")
command1.enable = false
else
command1.enable = true
end sub
in fact what i want is to enable and disable the command buttons basing on
some conditins how and which events to use
 
L

luanhoxung

dear friends,
i have an Open_up form with many command buttons on its header.
form based on a fields
1) loginname
2) password
my code goes like this
private sub form activate ()
if is null(loginname) and isnull(password) then msgbox ("xyz")
if password <> "balu" then msgbox("xyz")
command1.enable = false
else
command1.enable = true
end sub
in fact what i want is to enable and disable the command buttons basing on
some conditins how and which events to use

hi, Balu
I dont see "End If" in ur sub !
Luan
 
J

John W. Vinson

dear friends,
i have an Open_up form with many command buttons on its header.
form based on a fields
1) loginname
2) password
my code goes like this
private sub form activate ()
if is null(loginname) and isnull(password) then msgbox ("xyz")
if password <> "balu" then msgbox("xyz")
command1.enable = false
else
command1.enable = true
end sub
in fact what i want is to enable and disable the command buttons basing on
some conditins how and which events to use

Several things wrong. If you're referring to form controls, use

Me!loginname

rather than the undefined variable loginname. Secondly, in one place you have

is null(...
and in another
isnull(...

The function name is IsNull (with no space).

Putting the password in clear in your code makes this VERY insecure.

John W. Vinson [MVP]
 
G

Guest

great thanks for the advise,
kindly tell me which event to attach this code so that whenever the preset
conditions that go false at any stage of form operation command button should
disable and enable
(2) how to tally the preset password for an user. an table it is like this
table, users
field ,users (text)
" password alloted (text)
now on the open up form user will choose his name and type his alloted
password
but how to crosscheck the password for the perticular user and thus
enable and disable the command buttons kindly help please.
 

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