473,320 Members | 1,859 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,320 software developers and data experts.

Why do i get Type Mistmatch ?

2
I have created a form for the user to enter password before accessing the system
The table password has been created with the field uname of type Text and pword of type Text. The uname is displayed as a combo box on the form. When I enter the password and click ok it says Type Mismatch (Error 13)

Here is the code:

Option Compare Database

Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize

uname.SetFocus
End Sub

Private Sub cmd_close_Click()
DoCmd.close
End Sub

Private Sub ok_Click()
Dim rcd As Recordset
Set dbs = CurrentDb
If (IsNull(uname) Or Len(Trim(uname)) = 0) Then
s = MsgBox("Please check that you have entered your username!")

Else
If (IsNull(pword) Or Len(Trim(pword)) = 0) Then
s = MsgBox("Please check that you have entered your password!")

Else
Set rcd = dbs.OpenRecordset("select pword from password where uname='" + Me.uname + "'")

If rcd!pword = Me.pword Then
DoCmd.close
DoCmd.OpenForm "mainmenu"
Else
DoCmd.Beep
bool = MsgBox("Invalid password! Try again please")
pword = " "
pword.SetFocus
End If
End If
End If
End Sub



Thnks for your help :)
Aug 14 '08 #1
3 1253
hjozinovic
167 100+
which Access version do you have?
In Access 2003 you can go to Tools->Security...
[HTML]Make password-protected database
Create .mdw file with users/user groups
Join the database to the .mdw file[/HTML]

This is probably far better than the solution you are trying to use.
Also it's possible to use .mdw file with Acc2007.

I suggest you try reading help on security, user and group accounts etc.
Aug 14 '08 #2
k35hav
2
which Access version do you have?
In Access 2003 you can go to Tools->Security...
[HTML]Make password-protected database
Create .mdw file with users/user groups
Join the database to the .mdw file[/HTML]

This is probably far better than the solution you are trying to use.
Also it's possible to use .mdw file with Acc2007.

I suggest you try reading help on security, user and group accounts etc.
Well..first of all thank you for your reply :)
i wanted to create that form as it shall have different users. Thus preventing some users to access some forms..
I dont think that the password wizard in access can help me out..
The database is in 2002 format
can you help?
Aug 14 '08 #3
missinglinq
3,532 Expert 2GB
Set rcd = dbs.OpenRecordset("select pword from password where uname='" + Me.uname + "'")

I think Access is popping a Type Mismatch error because it sees you as trying to add your uname and quotation marks! You're using plus signs (+) for your concatenation, and you should be using the ampersand (&) sign instead.

Welcome to Bytes!

Linq ;0)>
Aug 14 '08 #4

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

Similar topics

6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
0
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
3
by: john | last post by:
Hi to All To demonstrate: public class MyBaseGenericClass<T> { } public class MyGenericClass1<T: MyBaseGenericClass<T> {
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
9
by: weirdwoolly | last post by:
Hopefully someone will be able to help. I have written a stored procedure in C++ called from a Java test harness to validate the graphic data types in C++ and their use. I have declared the...
5
by: JH | last post by:
Hi I found that a type/class are both a subclass and a instance of base type "object". It conflicts to my understanding that: 1.) a type/class object is created from class statement 2.) a...
10
by: Dave griffiths | last post by:
Hi all Using VB2005 on Vista with a Norwegian locale setup. The test program has 3 textboxes the sum held in txt3. Using the code below, txt2 conversion causes an error when it is left empty....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.