flow control again! IF STATEMENT SYNTAX

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Glad to have helped, Peter. But now the curiosity is killing me ... which
one was it? The UCase thing?
 
Hi Brendan

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

Thanks again.

Peter
 
Back
Top