Try this!!
Try this: Instead of using "LoginName = " & txtLogin.Text in the third parameter of the DLookup sentence, add single quotation marks, just like this:
"LoginName = ' " & txtLogin.Text & "'"
If this doesn't work, try using the full path to your form control (e.g...