Solved

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

Posted on 2004-08-12
5
187 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA color chart bars 12 79
Copy a row 12 59
Visual Studio search word table and return Cell index 8 49
Help me. 3 48
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now