Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2008, 08:46 AM
Registered User
 
Join Date: Apr 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default task reminder

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

[u]Listbox Code</u>
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
 
Old April 20th, 2008, 02:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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...-Hate-You.aspx
================================================== =========
 
Old April 21st, 2008, 06:23 AM
Registered User
 
Join Date: Apr 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

 
Old April 21st, 2008, 10:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add task in Scheduled Task programatically amitjoshipune C# 2 July 31st, 2008 05:42 AM
Task Reminder!!!! FEAF VB Databases Basics 1 April 23rd, 2008 02:43 PM
Execute Task from ActiveX Script Task PorcupineRabbit SQL Server DTS 1 January 10th, 2006 12:37 PM
reminder system niy VB Databases Basics 0 June 13th, 2005 03:59 AM
Auto Reminder Email netwizard_01 Classic ASP Basics 2 January 26th, 2005 10:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.