I am unsure whether it is generally impossible to use a logic function between to comparisons or if I've used my logic statement incorrectly because when I make all variables (NewUsername, NewUsername2, NewPass, NewPass2) to the characters "hi", it would continue to display the Application.MessageBox.
procedure TNewUserFrm.ApplyBtnClick(Sender: TObject);
begin
if (NewUsername <> NewUsername2) or (NewPass <> NewPass2) then
begin
Application.MessageBox('The usernames or passwords do not match. Try again', 'Error');
end
else
begin
if not modFile.UsersDataSet.Active then modFile.UsersDataSet.Open;
modFile.UsersDataSet.Append;
modFile.UsersDataSet.FieldByName('Username').AsString := NewUsername.Text;
modFile.UsersDataSet.FieldByName('Password').AsString := NewPass.Text;
modFile.UsersDataSet.Post;
NewUserFrm.Hide;
end;
NewUsername.Text := '';
NewUsername2.Text := '';
NewPass.Text := '';
NewPass2.Text := '';
ApplyBtn.SetFocus;
end;
I have tried using "and" statement, "or" statement and I've also tried using nested "if" statements instead but the same result occurs