MsgBox not working!

romio

Registered User.
Local time
Yesterday, 16:02
Joined
Apr 20, 2005
Messages
68
Can anyone tell me whats wrong with this code, its not working for me!!

Code:
If ((txtpassword = "") Or (combusername = "")) Then

MsgBox "Please Enter A Valid Access", vbOKOnly, "Error"

End If
 
Update if I click on my clear button

Code:
combusername = ""
txtpassword = ""
combusername.SetFocus

Then click on my Enter button then the msg comes out!! Having an empty box is not equal to ""?
 
Null is not the same as an empty string :) try :-

If ((nz(txtpassword,"") = "") Or (NZ(combusername,"") = "")) Then

MsgBox "Please Enter A Valid Access", vbOKOnly, "Error"

End If

HTH

Peter
 
yeah that works, What I have done is adding this sub on my form load:

Code:
Private Sub Form_Load()

combusername = ""
txtpassword = ""
combusername.SetFocus

End Sub

Is this a good method to implement or not?

Thanks.
 
as long as it works :)

Could probably do it by setting the controlls default values to "" as well.

I would doulble check whether adding an entry and deleting it sets the value to "" or Null !!

Peter
 

Users who are viewing this thread

Back
Top Bottom