First you need to create a recordset to see if the email or username existst in the database.
If you want to be able to display a different message if the user name is already in the database, you need to create two recordset. One to check for the user name, one to check for the password.
crate the first recordset, named usernameLookup. Set it to filter the username column on the username form element.
Create the second recordset as emailLookup, Set it to filter the email column on the email form element.
Then add server validation. For the username, use Numeric validation. Set the server variable to "$totalRows_usernameLookup", set the minimum to -1 and the max to 0. same for the the email, use numeric validation. Set the server variable to "$totalRows_emailLookup" the minimum should be set to -1 and the max set to 0.
Setting the validation this way will check that either recordset is empty.