Eddie Mason
Registered User.
- Local time
- Today, 07:23
- Joined
- Jan 31, 2003
- Messages
- 142
I have cribbed the following code from one of the ‘sample databases’ however what I would like it to do is to append ADate, AMonth and AYear into tblAppointments. Is there any way to achieve this?
If Me.months > 0 Then
Dim ad As Date
Dim f1 As Double
Dim f2 As Double
Dim ADate As Date
Dim AMonth As String
Dim AYear As Double
For rl = 1 To Me.List8.ListCount
Me.List8.RemoveItem (0)
Next rl
f1 = 2
f2 = Me.months + 1
For fd = Date To DateSerial(Year(Date), month(Date) + 1, 0)
If Weekday(fd) = 6 Then
f1 = 1
f2 = Me.months
End If
Next fd
For i = f1 To f2
ad = DateSerial(Year(Date), month(Date) + i, 0)
For k = 0 To 6
If Weekday(DateSerial(Year(ad), month(ad) + 1, 0) - k) = 3 Then
dd = DateSerial(Year(ad), month(ad) + 1, 14) - k
Me.List8.AddItem "Second Tuesday date. ;" & Format(dd, "dd-mmm-yyyy") & ";" & MonthName(month(dd)) & ";" & Year(dd)
ADate = Format(dd, "dd-mm-yyyy")
AMonth = MonthName(month(dd))
AYear = Year(dd)
End If
Next k
Next i
Else
MsgBox "Write first month in above text box"
End If
End Sub
Kind regards
Eddie
If Me.months > 0 Then
Dim ad As Date
Dim f1 As Double
Dim f2 As Double
Dim ADate As Date
Dim AMonth As String
Dim AYear As Double
For rl = 1 To Me.List8.ListCount
Me.List8.RemoveItem (0)
Next rl
f1 = 2
f2 = Me.months + 1
For fd = Date To DateSerial(Year(Date), month(Date) + 1, 0)
If Weekday(fd) = 6 Then
f1 = 1
f2 = Me.months
End If
Next fd
For i = f1 To f2
ad = DateSerial(Year(Date), month(Date) + i, 0)
For k = 0 To 6
If Weekday(DateSerial(Year(ad), month(ad) + 1, 0) - k) = 3 Then
dd = DateSerial(Year(ad), month(ad) + 1, 14) - k
Me.List8.AddItem "Second Tuesday date. ;" & Format(dd, "dd-mmm-yyyy") & ";" & MonthName(month(dd)) & ";" & Year(dd)
ADate = Format(dd, "dd-mm-yyyy")
AMonth = MonthName(month(dd))
AYear = Year(dd)
End If
Next k
Next i
Else
MsgBox "Write first month in above text box"
End If
End Sub
Kind regards
Eddie