Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query.. can this be done

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
US
I have been asked to find out if a query can be done to do the following.

We have a database that houses our passwords (access 2003) for our various domain user accounts.

Management want to be able to run a report linked to a query that will check the passwords to make sure they conform to our password criteria of:

Alphanumeric
Upper and Lower case

Can this be done with a query and the sent to a report?

If so how?
 
You are not seriously suggesting that you want a report listing out the passwords are you?

 
no, we will not list the passwords just whether they conform to our password policy, I just need to check password complexity as follows:

1. Upper/lowercase
2. Numeric
3. atleast 8 characters

If the passwords meet these 3 then they meet otherwise they do not. I figured we query the table for user id and password and the check the password somehow for the above. let it dish out a report stating the ID and whether it meets or not. pretty simple I would think, I just don't know how to start it.
 
All you should need to do would be to create a query, then in the criteria row at the bottom, just put the test for each of the items you have listed above. for example, for uppercase, you could use the ucase function, for numeric, use the numeric function, and for 8 characters, use the len function. You can put all three criteria in the same query. then your results will show only the records that match your criteria. After that, you can then do an unmatched query between that list and your original list. You can also have a cross reference table in your database that would list the people's real names, where their passwords don't conform.
 
Test for length:
len(password)>=8

case: (requires two tests)
strcomp(ucase(password),password,0)= false
and strcomp(lcase(password),password,0) = false

number:
mmmm.... probably requires a function to be written to check each character.

hasnumber(password) = true

Function HasNumber(vPass)
HasNumber = false
dim x
for x = 1 to len(vpass)
if chr(mid(vpass,x,1)) >=48 and chr(mid(vpass,x,1)) <=57 then
'ok
HasNumber = true
exit for
else
end if
next x
end function

 
could we use a charset query to check the entire field for say a-z, A-Z and 0-9 ?
 
You could build all the tests into one function, if that's what you mean. You would need flags to match each rule, wouldn't you.
Function PWOK(vPass)
pwok = false
Dim lengthOK as boolean
dim UpperOK as boolean
Dim LowerOK as Boolean
dim NumberOK as boolean
dim charsok as boolean
dim x
lengthok = false
upperok = false
lowerok = false
numberOK = false
CharsOK = true

if len(vpass)>=8 then lengthok = true

for x = 1 to len(vpass)
select case chr(mid(vpass,x,1))
case 48 to 57
NumberOK = true
case 65 to 90
upperok = true
case 97 to 122
lowerok = true
case else
charsok = false
end select
next x
pwok = lenghtok and upperok and lowerok and charsok and numberok
 
how would I make the flags for the rules and get that into the query? sorry but i am not good in access.
 
paste the code above in a module (it may need some tweaking), then something like this in your query:

SELECT * from tablename where Not PWOK(PasswordField)

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
I get a undefined function 'PWOK' in expression now..
 
The function needs to be placed into a standard module, not a form module.
 
I put this in a standard module I thought. I'm not sure I know the difference between standard module and form module.. I went to modules and created a new one, does not give me an option for standard or form..
 
Can you compile your code OK?
In athe code mode, do Debug.compile ......
Does it produce any errors?
 
what's the SQL of the query you are trying to run?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
SELECT * from nsaplog where Not PWOK(nspword)
 
If you click into the Immediate/Debug window in the code area and do:

?pwok("abcd")
and press enter, what do you get?
 
Have you renamed the module?
If so change it to Module1 or something similar.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top