Function ChangeDate(adate As Long) As Long
Dim t As Integer
Dim num As Long
Dim num2 As Long
Dim max As Object
Dim snumber As Object
Set dbcurrent = currentdb()
num = Left(adate, 3)
num2 = Right(adate, 4)
For t = 0 To t = dbcurrent.Tabledefs("Table1").RecordCount
If num >= 100 Then
adate = updatedate1(num, num2)
End If
adate = adate
Next
ChangeDate = adate
End Function
Function updatedate(num As Long, num2 As Long) As Long
Select Case [num]
Case 100
num = Left("00", 2) & Left(num2, 4)
Case 101
num = Left("01", 2) & Left(num2, 4)
Case 102
num = Left("02", 2) & Left(num2, 4)
End Select
updatedate = Left(num, 6)
End Function
This is the code I have written to try and update a series of dates which I have had downloaded from a legacy system into access. The year 2000 dates and later are preceded with a 1 so as to be year 2000 compliant. eg. 1020510 is 10/05/02 when I run an update query with this function it is returns 2510 as the preceding zeros are omitted, is there any function I can insert which will prevent this from happening.
Cheers
Dim t As Integer
Dim num As Long
Dim num2 As Long
Dim max As Object
Dim snumber As Object
Set dbcurrent = currentdb()
num = Left(adate, 3)
num2 = Right(adate, 4)
For t = 0 To t = dbcurrent.Tabledefs("Table1").RecordCount
If num >= 100 Then
adate = updatedate1(num, num2)
End If
adate = adate
Next
ChangeDate = adate
End Function
Function updatedate(num As Long, num2 As Long) As Long
Select Case [num]
Case 100
num = Left("00", 2) & Left(num2, 4)
Case 101
num = Left("01", 2) & Left(num2, 4)
Case 102
num = Left("02", 2) & Left(num2, 4)
End Select
updatedate = Left(num, 6)
End Function
This is the code I have written to try and update a series of dates which I have had downloaded from a legacy system into access. The year 2000 dates and later are preceded with a 1 so as to be year 2000 compliant. eg. 1020510 is 10/05/02 when I run an update query with this function it is returns 2510 as the preceding zeros are omitted, is there any function I can insert which will prevent this from happening.
