Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: Year2000 in Category General VBA/VB6 : Date and Time from Total Visual SourceBook

Year 2000 four digit year displays and the two digit pivot year for VB6 and VBA with support for 32 and 64 bit API calls.

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modYear2000 module
IsOLELibNewer Procedure Determine if the installed OLE Automation library (OLEAUT32.DLL) has the sliding window algorithm in place. See the notes for the modYear2000 module for information on the sliding window algorithm.
GetResourceVersion Procedure Get file version information. This private procedure supports other members of the module.
SafeCenturyVBA Procedure Get the passed date with the century modified as determined by the specified pivot year. If the last two digits of the supplied date are less than or equal to the intPivot value, the 21st century is used. Otherwise, the 20th century is used. Note that any century information supplied in the varDateIn parameter is thrown away. This is because by the time a date gets to this procedure, VBA/VB6 has most likely already assumed the century and the date is therefore suspect. See the notes for the modYear2000 module for information on the sliding window algorithm.
SetShortDateFormat Procedure Set the Windows Control Panel (or WIN.INI) definition for short date format. Note that setting Control Panel Short Date format to four digit years is not a robust solution to the Year 2000 problem--it is merely a stop-gap workaround. For details, see the notes for the modYear2000 module.
ShowCurrentShortDate Procedure Get the current Windows Control Panel (or WIN.INI) short date setting. Note that setting Control Panel Short Date format to four digit years is not a robust solution to the Year 2000 problem--it is merely a stop-gap workaround. For details, see the notes for the modYear2000 module.
WinINIGetSetting Procedure Get a string value from the WIN.INI file. This is a private helper procedure that supports other members of the module.
WinINIWriteSetting Procedure Writes the specified value to WIN.INI. This is a private helper procedure that supports other members of the module.

Example Code for Using Module: Year2000

' Example of modYear2000
'
' To use this example, create a new module and paste this code into it.
' Then run the procedure by putting the cursor in the procedure and pressing:
'    F5 to run it, or
'    F8 to step through it line-by-line (see the Debug menu for more options)

Private Sub Example_modYear2000()
  ' Comments: Example of using the modYear2000 module for four digit years in VBA and VB6.

  Dim fSlidingWindow As Boolean
  Dim strText As String

  ' Determine if the installed OLE Automation library (OLEAUT32.DLL) is the newer version which supports the sliding window algorithm.
  fSlidingWindow = IsOLELibNewer()

  strText = "Your system is "

  If Not fSlidingWindow Then
    strText = strText & " not "
  End If

  strText = strText & "using the newer version of the OLE automation library which supports the sliding window algorithm."
  Debug.Print strText

  ' Next, see what the control panel's setting for short dates is
  Debug.Print "Your Short Date setting in Control Panel is: " & ShowCurrentShortDate()

  ' Set the short date format to show the full four digits of the year (Uncomment the next two lines to make this work.)
  ' strText = SetShortDateFormat("mm/dd/yyyy")
  ' Debug.Print "New short date is: " & strText

  ' Take a date that only has a suspected century and return the full date with a four-digit year according to the rules that
  ' our procedure defines.
  Debug.Print "The safe version of 01/12/22 with a pivot century of 29 is: " & Format$(SafeCenturyVBA(#1/12/2022#, 29), "mm/dd/yyyy")

  Debug.Print "The safe version of 01/12/50 with a pivot century of 29 is: " & Format$(SafeCenturyVBA(#1/12/1950#, 29), "mm/dd/yyyy")

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources