Issue with rs type mismatch

mloucel

Member
Local time
Today, 07:44
Joined
Aug 5, 2020
Messages
309
Hello all,
I have this same routine in another program and it works, but here in this one I have no freaking idea why is giving me the runtime error 13, Type Mismatch error.
I know what is mismatch, but I checked the table and the txt field is the same thing, so I am confused.
if anyone can point me towards what in the world is wrong with it, I will appreciate it very much.

Login Routine..
 

Attachments

You had
Code:
    If Nz(Me.UserLoginTxt, "") Or Me.UserLoginTxt.Value = "" Then
when you need
Code:
    If Nz(Me.UserLoginTxt, "") = "" Or Me.UserLoginTxt.Value = "" Then

or use If Nz(Me.UserLoginTxt, False) though I have never tried that myself. In essence you were trying to make the first test boolean.

I believe you could simplify with
Code:
If Me.UserLoginTxt & "" = ""
 
Your code:
Code:
If Nz(Me.UserLoginTxt, "") Or Me.UserLoginTxt.Value = "" Then

Looks like:
Code:
If StringValue or BooleanValue then
or
Code:
If StringValue or Null then

I think you want:
Code:
If Nz(Me.UserLoginTxt.Value, "") = "" Then
Or maybe you confuse Nz with IsNull?
Code:
If IsNull(Me.UserLoginTxt.Value) Or Me.UserLoginTxt.Value = "" Then

Tip: disable the button while UserLoginTxt is empty.


[OT]
Data field with name [Active Or Not] ... this is always set to True, right? ;)
 
Last edited:
You had
Code:
    If Nz(Me.UserLoginTxt, "") Or Me.UserLoginTxt.Value = "" Then
when you need
Code:
    If Nz(Me.UserLoginTxt, "") = "" Or Me.UserLoginTxt.Value = "" Then

or use If Nz(Me.UserLoginTxt, False) though I have never tried that myself. In essence you were trying to make the first test boolean.

I believe you could simplify with
Code:
If Me.UserLoginTxt & "" = ""
AHHH, The Devil is in the details section... @Gasman , I even did line by line, and somehow, even when that stupid ="" was missing I didn't see the small print, what a moron..
And BTW all your solutions worked perfectly, I added them as comments to remind myself of the simplicity of life, and be more careful next time.

Thank you Sir, your wisdom is forever recognized.
 

Users who are viewing this thread

Back
Top Bottom