Solved

How can I determine from my vb app if my sybase password has expired

Posted on 2004-08-12
5
209 Views
Last Modified: 2006-11-17
I need to be able to update my password on sybase, from my vb application, when it has expired. Something similar to the way the nt login works i.e. a few days before it is due to expire, when you logon you are asked if you would like to change it. You type in the old and new one and then it is updated

I know within sybase you can run the following to do the update

                      EXEC sp_password 'oldPassword', 'newPassword', 'loginName'

How can I tell if the password has expired or is there anywhere that I can set a flag to i.e. if its the last day of the month prompt the user that they need to change their password
0
Comment
Question by:INDYND
[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
  • 2
5 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 11798142
Sorry, I don't use or have access to Sybase so I can't answer the portion of your post about how to tell if the password has expired.  I can provide a sample, actually two samples, of ways to prompt the user to change their password at the end of the month.  The first sample tests to see if today's date is within x, I used 7 as an example,  days of the end of the month.  If it is, then it displays a dialog box advising the user that it's time to think about changing their password.  The second example is essentially the same as the first, but returns the number of days to the end of the month.  This allows for a dialog box like the one in Windows that reminds the user each day that their password expires in x days.  


    If PWExpirationNoticeA(Date, 7) Then
        MsgBox "Password expires within 7 days."
    End If
   
    intdaystillexpiration = PWExpirationNoticeB(Date)
    If intdaystillexpiration <= 7 Then
        MsgBox "Your password expires in " & intdaystillexpiration & " day(s)."
    End If

Public Function PWExpirationNoticeA(datDate As Date, intDaysInAdvance As Integer) As Boolean
    'Checks to see if the date passed is within a certain number of days of the end of the month.
    'Returns True if it is.
    Dim datEOM As Date
    datEOM = datDate + DateDiff("d", datDate, DateAdd("m", 1, datDate)) - Day(datDate)
    PWExpirationNoticeA = (DateDiff("d", datDate, datEOM) <= 7)
End Function

Public Function PWExpirationNoticeB(datDate As Date) As Integer
    'Calculates the number of days between the date passed and the end of the month for the date passed.
    'Returns the number of days difference.
    Dim datEOM As Date
    datEOM = datDate + DateDiff("d", datDate, DateAdd("m", 1, datDate)) - Day(datDate)
    PWExpirationNoticeB = DateDiff("d", datDate, datEOM)
End Function
0
 
LVL 76

Expert Comment

by:David Lee
ID: 12398498
I held off on posting a recommendation in the hopes that Indynd would finalize the question.  In the absence of that I recommend accepting my answer (http:#11798142).
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

730 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