473,395 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Run-time error '13' Type mismatch

2
I have a table [Users] consist of two fields UserID and Password, and a form with unbounded fields txtUserID and txtPassword.
I’m running the below code on MS Access 2000 and I’m getting Run-time error '13' Type mismatch,
the line >Set rsT_Users = CurrentDb.OpenRecordset(StrSQL, dbOpenSnapshot)< highlighted in yellow.
the same code worked for me on another DB, I don’t know whats wrong could anyone help please.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3. Dim intLoginFails
  4. ---------------------------------------
  5. Private Sub cmdLogin_Click()
  6. Dim rsUsers As Recordset
  7. Dim StrSQL As String
  8. StrSQL = ""
  9. txtUserID.SetFocus
  10. StrSQL = "Select * From [Users] Where [Users].[UserID]='" & txtUserID & "'"
  11. txtPassword.SetFocus
  12. StrSQL = StrSQL + " AND [Users].[Password]='" & txtPassword & "'"
  13. Set rsUsers = CurrentDb.OpenRecordset(StrSQL, dbOpenSnapshot)
  14. If rsUsers.EOF Then
  15.     intLoginFails = intLoginFails + 1
  16.     If intLoginFails > 3 Then
  17.         MsgBox "You have exceeded then number of attempts"
  18.         DoCmd.Quit
  19.     End If
  20.     MsgBox "Invalid User Name Or Password"
  21. Else
  22.    MsgBox "Correct user Name and Password"
  23.  
  24. End If
  25. End Sub
  26.  
Mar 21 '07 #1
2 3686
mujaqo
2
I found it
Dim rsUsers As DAO.Recordset
Mar 21 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
I found it
Dim rsUsers As DAO.Recordset
I'm glad you found it. This happens when the ADO and DAO library are both ticked in the references list. Access doesn't know which to use.

Mary
Mar 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
2
by: Jenna Olson | last post by:
Hi all- I've never seen this particular issue addressed, but was wondering if there's anything to support one way or another. Say I have a class: class ManipulateData { public:...
15
by: mg | last post by:
How can I run an .exe using C# from within the code behind of a WebForm app?
6
by: billr | last post by:
I have developed a small API for taking care of a lot of boiler plate stuff in a multi formed windows application, for example setting up a messaging thread framework. New Forms, in the...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
9
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. ...
7
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: ...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
7
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.