UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Type Mismatch Error, Access 2016    
 
   
CCSlice
post Apr 11 2019, 07:45 AM
Post#1



Posts: 180
Joined: 12-August 07
From: Toronto, Canada


Hi UA Nation!

I have been challenged with this annoying Type Mismatch error that I cannot seem to get rid of. I have created a login procedure that seems to do what it is supposed to do, but not... smoothly.

After the user enters his/her credentials, the database does open but there is a Type Mismatch error upon opening a new form (Splashscreen). A similar problem exists when I have the user update his or her password as a new user. I am sure that there is a connection with the two errors, so I am not asking for both to solved individually; however your help can lead me to right solution.

Thank you in advance for your help UA Nation!



Attached File(s)
Attached File  Sample_Db_Type_Mismatch_Error.zip ( 242.49K )Number of downloads: 5
 
Go to the top of the page
 
Doug Steele
post Apr 11 2019, 08:00 AM
Post#2


UtterAccess VIP
Posts: 22,126
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Can you provide instructions for how to see the error?


--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
Personal webpage
Microsoft profile
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
Minty
post Apr 11 2019, 08:17 AM
Post#3



Posts: 265
Joined: 5-July 16



Quite a few errors. You would be able to spot them much easier if you did two things;

Comment out your error handler, and the let the debugger show you what is wrong.

Add Option Explicit to the top of all you code modules. There is an option in the access file options to require variable declaration, tick it.

Change the form close line to

DoCmd.Close acForm, "frmLogin"

Finally you are using this code;
CODE
    With User
        .AccessID = rst.Fields("AccessID")
        .ViewID = rst.Fields("ViewID")
        .Active = rst.Fields("Active")
        .Loginword = rst.Fields("Loginword")
        .SecuirtyID = rst.Fields("SecurityID")
        .UserID = rst.Fields("UserID")
    End With


What is User ? It's not declared and doesn't reference anything anywhere.
Go to the top of the page
 
CCSlice
post Apr 11 2019, 08:32 AM
Post#4



Posts: 180
Joined: 12-August 07
From: Toronto, Canada


Hi Doug,

The login form captures your workstation or machine login. So you would need to create your login in the tbl_Security and then initiate the frm_Login and see the Type Mismatch error, that I am talking about. In fairness to everyone, this is an old code that I used on an Access 2007 database and I know that with the new edition that there are modules of mine that are not compatible, but this mismatch error is confusing. At first, I thought it was ADO vs DAO, but I have used the proper References.

CC
Go to the top of the page
 
Minty
post Apr 11 2019, 08:38 AM
Post#5



Posts: 265
Joined: 5-July 16



As stated above your type mismatch is caused by this line ;

DoCmd.Close "frmLogin"

Which should be

DoCmd.Close acForm, "frmLogin"
Go to the top of the page
 
CCSlice
post Apr 11 2019, 08:57 AM
Post#6



Posts: 180
Joined: 12-August 07
From: Toronto, Canada


Thanks Minty! Yes, this escaped my eyes!

As for the User, I failed to add the module that declares it. It should be:

CODE
Public Type UserInfo
         ViewID as Integer
          AccessID as Integer
          Active as Boolean
          Loginword as String
          UserID as String
          SecurityID as String
          End Type

          Public User as UserInfo


I would like to hold the user information into memory.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    23rd April 2019 - 01:02 AM