hi,
i'm trying to create a reminder form on vb6 with access holding the reminders.
i was given a code that checks the list box where all the reminders are shown on vb to see if any of the reminders match the actual time and date.
my problem is that if there is a reminder that matches the actual time and date then the message box will show but the item shown in the message box is always the one on the top of the list.
this is my form load and my listbox code:
FORM LOAD
[code=vb]
Private Sub Form_Load()
'
Dim s() As String
Dim ListTime As String
Dim ListDate As String
Dim name As String
Dim i As Integer
Set dbReminder = OpenDatabase(Ap p.Path & "\Password.mdb" )
Set rsReminder = dbReminder.Open Recordset("Remi nder", dbOpenDynaset)
If Not rsReminder.EOF Then rsReminder.Move First
Do While Not rsReminder.EOF
lstReminder.Add Item rsReminder!Rno & "." & " " & rsReminder!name & vbTab & vbTab & rsReminder!Date & vbTab & rsReminder!TIME
lstReminder.Ite mData(lstRemind er.NewIndex) = rsReminder!Rno
rsReminder.Move Next
Loop
Set dbReminder = OpenDatabase(Ap p.Path & "\Password.mdb" )
Set rsReminder = dbReminder.Open Recordset("Remi nder", dbOpenDynaset)
For i = 0 To lstReminder.Lis tCount - 1
s = Split(lstRemind er.List(i), vbTab)
'name = Mid(s(UBound(s) ))
ListTime = Mid(s(UBound(s) ), 1, Len(s(UBound(s) )) - 3)
ListDate = s(UBound(s) - 1)
'MsgBox name = Mid(s(UBound(s) ), 1, Len(s(UBound(s) )))
If ListTime = Mid(TIME, 1, Len(TIME) - 3) And ListDate = Date Then
MsgBox rsReminder!Name
End If
Next
End Sub
LIST BOX
Private Sub lstReminder_Cli ck()
'
rsReminder.Find First "Rno=" & (lstReminder.It emData(lstRemin der.ListIndex))
rsReminder!Rno = frmReminder.txt no.Text
rsReminder!name = frmReminder.txt Name.Text
rsReminder!Date = frmReminder.txt Date.Text
rsReminder!TIME = frmReminder.txt Time.Text
rsReminder!Comm ents = frmReminder.txt Comment.Text
End Sub
[/code]
in the for statement this is where the mesage is shown " MsgBox rsReminder!Name "
please can you explain why it only shows the first item on the list.
i'm trying to create a reminder form on vb6 with access holding the reminders.
i was given a code that checks the list box where all the reminders are shown on vb to see if any of the reminders match the actual time and date.
my problem is that if there is a reminder that matches the actual time and date then the message box will show but the item shown in the message box is always the one on the top of the list.
this is my form load and my listbox code:
FORM LOAD
[code=vb]
Private Sub Form_Load()
'
Dim s() As String
Dim ListTime As String
Dim ListDate As String
Dim name As String
Dim i As Integer
Set dbReminder = OpenDatabase(Ap p.Path & "\Password.mdb" )
Set rsReminder = dbReminder.Open Recordset("Remi nder", dbOpenDynaset)
If Not rsReminder.EOF Then rsReminder.Move First
Do While Not rsReminder.EOF
lstReminder.Add Item rsReminder!Rno & "." & " " & rsReminder!name & vbTab & vbTab & rsReminder!Date & vbTab & rsReminder!TIME
lstReminder.Ite mData(lstRemind er.NewIndex) = rsReminder!Rno
rsReminder.Move Next
Loop
Set dbReminder = OpenDatabase(Ap p.Path & "\Password.mdb" )
Set rsReminder = dbReminder.Open Recordset("Remi nder", dbOpenDynaset)
For i = 0 To lstReminder.Lis tCount - 1
s = Split(lstRemind er.List(i), vbTab)
'name = Mid(s(UBound(s) ))
ListTime = Mid(s(UBound(s) ), 1, Len(s(UBound(s) )) - 3)
ListDate = s(UBound(s) - 1)
'MsgBox name = Mid(s(UBound(s) ), 1, Len(s(UBound(s) )))
If ListTime = Mid(TIME, 1, Len(TIME) - 3) And ListDate = Date Then
MsgBox rsReminder!Name
End If
Next
End Sub
LIST BOX
Private Sub lstReminder_Cli ck()
'
rsReminder.Find First "Rno=" & (lstReminder.It emData(lstRemin der.ListIndex))
rsReminder!Rno = frmReminder.txt no.Text
rsReminder!name = frmReminder.txt Name.Text
rsReminder!Date = frmReminder.txt Date.Text
rsReminder!TIME = frmReminder.txt Time.Text
rsReminder!Comm ents = frmReminder.txt Comment.Text
End Sub
[/code]
in the for statement this is where the mesage is shown " MsgBox rsReminder!Name "
please can you explain why it only shows the first item on the list.
Comment