Issue:
You have a database that is used by multiple PCs over your network and tracks the time an entry was keyed. You want to store this date as GMT.
Resolution
- First, create a Module with the following code referencing the PC's system
- Option Compare Database
- Declare Function GetTimeZoneInformation Lib "kernel32.dll" &_
- (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
- Type SYSTEMTIME
- wYear As Integer
- wMonth As Integer
- wDayOfWeek As Integer
- wDay As Integer
- wHour As Integer
- wMinute As Integer
- wSecond As Integer
- wMilliseconds As Integer
- End Type
- Type TIME_ZONE_INFORMATION
- Bias As Long
- StandardName(0 To 31) As Integer
- StandardDate As SYSTEMTIME
- StandardBias As Long
- DaylightName(0 To 31) As Integer
- DaylightDate As SYSTEMTIME
- DaylightBias As Long
- End Type
- Second, place a control on your form to calculate the date information (I chose the lost focus event for a text box)
- Private Sub Text0_LostFocus()
- 'receives information on the time zone
- Dim tzi As TIME_ZONE_INFORMATION
- Dim x As Date
- Text0.Text = DateAdd("h", (tzi.Bias / 60), x)
- End Sub
� 2002 Dan Herrera
These functions may be distributed freely, but please give credit where credit is due.
And if you feel you must give credit, or have a request for a custom function/macro,
please send me a note DataMasterFla
Sign Guestbook
View Guestbook
Back.