R romio Registered User. Local time Yesterday, 16:02 Joined Apr 20, 2005 Messages 68 Jun 30, 2005 #1 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
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
R romio Registered User. Local time Yesterday, 16:02 Joined Apr 20, 2005 Messages 68 Jun 30, 2005 #2 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 ""?
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 ""?
B Bat17 Registered User. Local time Today, 00:02 Joined Sep 24, 2004 Messages 1,687 Jun 30, 2005 #3 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
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
R romio Registered User. Local time Yesterday, 16:02 Joined Apr 20, 2005 Messages 68 Jun 30, 2005 #4 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.
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.
B Bat17 Registered User. Local time Today, 00:02 Joined Sep 24, 2004 Messages 1,687 Jun 30, 2005 #5 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
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