flow control again! IF STATEMENT SYNTAX

P

PETER

I have tried various options to get the above statement to work without
success. Can anyone tell me the correct way.

If Me.qpwd.Value = "ADMIN" Then
..... ETC.

Many thanks.

Peter
 
B

Brendan Reynolds

There's nothing obviously wrong with the syntax, provided 'qpwd' is a) a
member of the object that contains this code, b) has a Value property and c)
returns a string. And, of course, that there is a corresponding "End If"
somewhere in your code.

If the code runs without error, but returns False when you expect True, it
could be a question of case sensitivity, e.g. perhaps qpwd returns "admin"
or "Admin" rather than "ADMIN". If you think that might be the problem, try
....

If UCase$(Me.qpwd.Value) = "ADMIN" Then
'etc
End If

If that's not it, try describing what 'qpwd' is, and what happens when you
try to run this code, and we may be able to identify the problem.
 
B

Brendan Reynolds

Glad to have helped, Peter. But now the curiosity is killing me ... which
one was it? The UCase thing?
 
P

PETER

Hi Brendan

you guessed correctly - The UCase thing. I completely forgot about
case!!!

Thanks again.

Peter
 

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