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

login access is not working

Hi,

when i run the code my second if condition is not checking the table wether user have admin access or not.

after checking 2nd condition its directly moving to else statement. please help me.


Expand|Select|Wrap|Line Numbers
  1. If Me.Text13.Value = DLookup("EMP_PW", "M_EMPINFO", "[EMP_NO]=" & Me.Combo2.Value) Then
  2.     If Me.Combo2.Value = DLookup("emp_no", "m_empinfo", "admin_access" = yes) Then
  3.     DoCmd.OpenForm "UserAccess_Form", acNormal, "", "", acFormAdd, acNormal
  4.      Else
  5. do something
Oct 10 '13 #1
3 955
zmbd
5,501 Expert Mod 4TB
Slightly alter your code:

Expand|Select|Wrap|Line Numbers
  1. '(...partial air code...)
  2. '(...some things left out...)
  3. '
  4. 'Two variables as variant to handle null/zero
  5. Dim varFirstValue As Variant
  6. Dim varSecondValue As Variant
  7. '
  8. '(...some things left out...)
  9. 'Pull your lookups
  10. varFirstValue = DLookup("EMP_PW", "M_EMPINFO", "[EMP_NO]=" & Me.Combo2.Value)
  11. varSecondValue = DLookup("emp_no", "m_empinfo", "admin_access" = yes)
  12. '
  13. 'Now let's see what was returned, personally, I'd put some code in here to check for bad returns; however, for TS... the debug.print will do for now...
  14. debug.print "FirstValue = " & varFirstValue
  15. debug.print "SecondValue = " & varSecondValue
  16. '
  17. 'Now once you know what is being returned by the functions and you have done proper error checking, THEN you can use these values:
  18. If Me.Text13.Value = varFirstValue Then
  19.     If Me.Combo2.Value = varSecondValue Then
  20.     DoCmd.OpenForm "UserAccess_Form", acNormal, "", "", acFormAdd, acNormal
  21.      Else
  22. do something
One should ideally never pull data without checking the returned data FIRST.
Oct 10 '13 #2
Rabbit
12,516 Expert Mod 8TB
You should not be storing passwords in plain text like this. It is a huge security risk.
Oct 10 '13 #3
zmbd
5,501 Expert Mod 4TB
Rabbit is absolutely correct, and something I was remiss in not mentioning... and there are several helpful insight articles that might help with that issue. One such would be: SHA2 Cryptographic Hash Algorithm for VBA and VBScript
There are a couple of others in the list too...
Oct 10 '13 #4

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

Similar topics

3
by: tchangmian | last post by:
I want to limit user login by writing ASP program. In details, if a user had logged in wrongly for more than three times, then the user will not be abled to log in to the system anymore even...
1
by: BD | last post by:
Hi, all: I have been tasked with determining how many licenses of a certain SQL Server 2000-based application are actually in use: in other words, record or log connections made to the database...
1
by: Kirk Groome | last post by:
Hi all, I'm working on a web site and I would like to use the VS login controls. The problem I'm having is that when I create a new user all works fine. The user gets added to the database and...
0
by: Rotsey | last post by:
Hi, I have a web site dev with VS2003, .NET 1.1. I am persisting the login with the statement below When I login and then close the browser repoen it works fine. But when I leave the session...
2
by: shaun.laughton | last post by:
Hi All. I am new to ASP.NET 2.0 development, and am writing a small application to log time and expenses for projects. I have successfully set up Membership, Role and Profile providers using...
0
by: Uwe | last post by:
Hi, I'm currently developing an ASP.NET application with my own MembershipProvider. Login works fine on my local machine (IIS7) in a virtual directory of IIS. I just deployed the application to a...
4
by: samatair | last post by:
Hi Enthusiasts of programming I need to do system where in php and mysql system where the users have different roles and they are given differnt privileges. example when an admin logs in he has...
6
by: gbaii | last post by:
Hi all. Being new to access and wanting to build some kind of basic CRM software, I have the following problem. I have a table called users with the fields: UserID, UserName, UserPass and UserType....
2
by: bradleyhogan | last post by:
I had implemented urlrewritingnet successfully but after adding forms authentication, none of the login controls work on the rewritten pages. <add name="Keyword" virtualUrl="^~/(.*)"...
0
by: TravelingCat | last post by:
Hi, My program contains events, each event has several assignments (displayed on the same form, in a subform). Each assignment has a checkbox, it's checked to send mail to "assignInCharge" to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.