Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

creating accounts

Posted on 2002-04-22
5
Medium Priority
?
164 Views
Last Modified: 2010-05-02
i have an application where it is password protected and connects to an MS Access DBase where there is a table in  it called "Users". Inside that table are the following fields.

Forename   Surname   Username    Password

each user can type in their username and password and logs into the program OK.

i would like to know how i can setup each persons account PASSWORD to expire in a certain amount of days and show on my form how many days are left before they have to change their password.
0
Comment
Question by:marksmall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 6961218
put a datefield called let's say "LastPwdChange".

Whenever you log-in, check this date against the current date using DateDiff ("d", Now(), rs.fields("LastPwdChange"))

if the result of Datediff is > number of days for expiration then prompt for change, otherwise show the result of datediff
0
 

Author Comment

by:marksmall
ID: 6962595
can you provide a code example!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6963187
const DAYS_TILL_PASSWORD_EXPIRES = 14  '' 2 weeks for example

public sub login()

   Dim conn as new ADODB.Connection
   Dim rs as new ADODB.Recordset
   Dim strSQL as string
   Dim daysSinceChange as integer

   conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Persist Security Info = False;" & _
              "Data Source=<your access db>"
   rs.open strSQL, conn, adOpenForwardOnly, adLockOptimistic

   if rs.EOF then
       msgbox "Incorrect User Name or Password"
   else
       daysSinceChange = DateDiff("d", Now(), rs.fields("LastPwdChange"))
       if daysSinceChange > DAYS_TILL_PASSWORD_EXPIRES then
            msgbox "you need to change your password"
            '' maybe open the form for doing so here
       else
            msgbox "you need to change your password in " & (DAYS_TILL_PASSWORD_EXPIRES - daysSinceChange)  
       end if        
   end if

   rs.close
   set rs = nothing
   conn.close
   set conn = nothing
     
end sub

0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6963190
oops, put rs.movefirst before the line "daysSinceChange = DateDiff(...)"
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 600 total points
ID: 6963199
also probably want to pass the username and password to the login sub:
ie.
sub login(uName as string, pass as string)

'' also, strSQL should look something like
strSQL = "Select * from tblUsers where userName = '" & uName & "' and Password = '" & pass & "'"

end sub

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question