Subject: task reminder
Posted By: FEAF Post Date: 4/20/2008 8:46:27 AM
hi,
i've been having so much trouble with this code, could someone please help me.
i'm trying to create a task reminder form where the user will enter the name, date and time the reminder shod appear. the reminder will be a msgbox with the name of the task and any additional info they may have added.

the reminders are in a listbox. this is too har for me as a beginner so i asked a mate for help but now i've got a problem and i can't reach him.

the code below is my form load and then my listbox code.

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(App.Path & "\Password.mdb")
    Set rsReminder = dbReminder.OpenRecordset("Reminder", dbOpenDynaset)
    
If Not rsReminder.EOF Then rsReminder.MoveFirst

Do While Not rsReminder.EOF
    lstReminder.AddItem rsReminder!Rno & "." & " " & rsReminder!name & vbTab & vbTab & rsReminder!Date & vbTab & rsReminder!Time
    lstReminder.ItemData(lstReminder.NewIndex) = rsReminder!Rno
    rsReminder.MoveNext
Loop

    Set dbReminder = OpenDatabase(App.Path & "\Password.mdb")
    Set rsReminder = dbReminder.OpenRecordset("Reminder", dbOpenDynaset)
    
For i = 0 To lstReminder.ListCount - 1
s = Split(lstReminder.List(i), vbTab)
ListTime = Mid(s(UBound(s)), 1, Len(s(UBound(s))) - 3)
ListDate = s(UBound(s) - 1)
If ListTime = Mid(Time, 1, Len(Time) - 3) And ListDate = Date Then
   MsgBox rsReminder!Name
End If
  Next
End Sub

Listbox Code
Private Sub List1_Click()
rsReminder.FindFirst "Rno=" & (lstReminder.ItemData(lstReminder.ListIndex))

rsReminder!Rno = frmReminder.txtno.Text
'.... the rest
End Sub

The main bit is in the form load 'For' code.
the problem(I think) i here:
If ListTime = Mid(Time, 1, Len(Time) - 3) And ListDate = Date Then
   MsgBox rsReminder!Name
if there is a reminder with date and time as the realtime and date then a message box for that reminder should show instead it show the name of the first item in the list.
If i replace 'rsReminder!Name' with 'lstReminder.List(i)' then it show the right reminder but it shows all the information. I don't know what else to do.
COULD SOMEONE PLEAS HELP ME!!!!!!!!!!!!!!!!!!!

AND IM USING VB6 AND ACCESS TO STORE THE REMINDERS
Reply By: gbianchi Reply Date: 4/20/2008 2:28:10 PM
Hi there.

Where is the problem???

You said that you want to show all the data for the remainder in a msgbox, and then further in the post you said that you accomplish it using Lstreminder.list(i) (wich is correct), so where is your problem?

HTH

Gonzalo

===========================================================
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
===========================================================
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
===========================================================
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles/Classics-Week-I-Hate-You.aspx
===========================================================
Reply By: FEAF Reply Date: 4/21/2008 6:23:17 AM
sorry i didn't explain it clearly.
What i want is for the message to show the title of the reminder and any other extra info (notes) not the time and date. the thing at the end that you think is the correct thing is just that i was checkin if it goes to the right reminder(item) and if i leave it like this the date and time will show. plus as i have used tabs in the listbox the msgbox will also have tabs.
To make it a bit more clear i want to know why it doesn't show the correct item in the message box if i use rsReminder!Name but it does select the right reminder.
please say if i need to xplain further.

Reply By: gbianchi Reply Date: 4/21/2008 10:18:13 AM
Ok.

You don't see the correct record because your list is not attached to your recordset. You fill the list reading all the records in the recordset and adding then manually to the list, so you have no control of the recordset (at least not from the point of view of the list). You have to search for the rigth record in the recordset (maybe you have a key to find the record, that is not clear in your code). Rereading your code, you are looking for the rigth record in the list_click event, so if you move that code before the msgbox you will be fine.

Msgbox doesn't have tabs, unless you build your own message box.

HTH

Gonzalo

===========================================================
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
===========================================================
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
===========================================================
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles/Classics-Week-I-Hate-You.aspx
===========================================================

Go to topic 70775

Return to index page 1