Issue with rs type mismatch (1 Viewer)

mloucel

Member
Local time
Today, 07:34
Joined
Aug 5, 2020
Messages
153
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

  • Authorizations - TEST.accdb
    652 KB · Views: 62

Gasman

Enthusiastic Amateur
Local time
Today, 15:34
Joined
Sep 21, 2011
Messages
14,306
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 & "" = ""
 

Josef P.

Well-known member
Local time
Today, 16:34
Joined
Feb 2, 2023
Messages
826
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:

mloucel

Member
Local time
Today, 07:34
Joined
Aug 5, 2020
Messages
153
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

Top Bottom