Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

creating accounts

Posted on 2002-04-22
5
Medium Priority
?
165 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
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

916 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