Link to home
Start Free TrialLog in
Avatar of isnoend2001
isnoend2001Flag for United States of America

asked on

Rename files in a reminder program Q28908876 vb6

I have reminder rtf files that need renaming from just showing the date to
showing the date and time. this will avoid duplicates
eg date/time including seconds
Yr20160105102555.rtf instead of  Yr01-07-2016.rtf
how to do this ?
28905119b.zip
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Currently no-repeat Days reminders don't get any prefix. At the same time as I do the above I'd like to use "D1" for that prefix. OK?
Avatar of isnoend2001

ASKER

OK
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
good job fixed right up still testing
Private Sub cmdDone_Click()
getting an error when clicking Done on a time reminder
User generated imageUser generated image
image to start with
User generated image
Included in this release.
Fixed a bug where trying to delete the last row produced a "Cannot delete the last non-fixed row" error.
Minor changes to when the "FlexGrid.dat not found. Create it?" error message appears so that it doesn't show up in a vacuum
Fixed a bug where if "Done" was clicked on frmDeferTime without first selecting a value from cboDeferTime, an error would occur.
Added a version number to the dat file to help ensure that the current file is being used.
To test the Version number code, edit the dat file. In the first line you'll find "1,10,1". Remove the last "1" (which is the version number} or change it, save the file and run the program.
28910123.zip
thanks testing
Ran the program without editing the dat file.
a new grid was created
created a one time AM/PM reminder to go off in 7 minutes from the pc time
i clicked Done when the reminder showed up, then this Showed:
User generated imageClosed The App and reopened and was presented with this:
User generated imagethe app created the dat file I did not touch it
contents of .dat file that was created thru code
2,10
"File Name","Entry Date","Reminder Description","Time/Date","Reminder Type","Next Reminder","Open","Delete","Delay","Notifications"
"Tm20160106095546.rtf","01-06-2016","One time 954","10:00 AM","No Repeat","0 Minutes","View","X","",""
I'm sorry I forgot to add the version number when the data is saved. In the SaveData sub change line 7 as shown. You'll also need to either delete your dat file or edit it to add the missing "1".

    '******* Q28905119D Start *******
'    max_row = grdName.Rows - 1
'    max_col = grdName.Cols - 1
    max_row = grdName.Rows
    max_col = grdName.Cols
    '******* Q28905119D End *********
    Write #fnum, max_row, max_col, DAT_VERSION

Open in new window

Thanks that fixed it
Downloaded and ran 28910123(1).zip and still get the error.User generated image
Am I missing something ?
Did you actually choose one of the entries in the list? When I do it works fine.
No I did not, shouldn't have to
So are you saying that when the time of the reminder comes up that the user doesn't have to dismiss or defer it?
The user should be able to click Done without selecting from the list.
example
 she has already takien her medicine and does want to select from the list, only click Done

if a daily time then stop reminder and set for tomorrw

if a No Repeat AMPM Time move the rtf to the deleted folder
then the row is removed from the grid and the grid re sized  and saved
I would rather the reminder show 5 times than just stay on the screen
if its shown vbmodal then any other reminders will fail
It's not going to stay on the screen.
ok
that fixes the issues, except on a daily time reminder you have to click done 4 times each
time the form reappears.
on a No Repeat ampm reminder it works perfectly
I'll work on that tomorrow.
ok
If at first you don't succeed...
28910123b.zip
Don't know why but it stll does not work for me:
Made a time reminder changed the time in the grid and then clicked view, worked perfectly.
then
made a No Repeat Date changed the date in the grid and then clicked view
the result:
User generated imagethe contents of the dat file:
3,10,"1"
"File Name","Entry Date","Reminder Description","Time/Date","Reminder Type","Next Reminder","Open","Delete","Delay","Notifications"
"Dy20160107083436.rtf","01-07-2016","ampm daily 834","8:41 AM","Daily","4 Minutes","View","X","",""
"01-09-2016","01-07-2016","one time date","01-09-2016","No Repeat","1 Day","View","X","",""
made a No Repeat Date changed the date in the grid and then clicked view
the result
Thanks, that information will help me find the problem.
I never could reproduce the problem but I made a small change that might fix it. I also...
Corrected a bug where if a daily reminder was deferred, the app closed and then reopened, an error occurred in the comparison beween Now() and the value in the Defer column because that value contained "Done".
When a date in column 3 was clicked it used to immediately change to the current date when frmCalendar was shown. This didn't hurt anything beacuse the date was changed when the new date was chosen from the calendar, but I changed the code so that the date in the grid doesn't change until the new date is selected from the calendar. It also was the case that the date that showed up initially in the calendar was today's date rather than the reminder date and I changed that as well.
28910123c.zip
Still getting the date changing error
Cannot determine why i get the error and you don't.
started with a new code created gridMaster
Entered a one time date for tomorrow
changed the date then clicked view and got the error
User generated imagecontents of the dat file:
2,10,1
"File Name","Entry Date","Reminder Description","Time/Date","Reminder Type","Next Reminder","Open","Delete","Delay","Notifications"
"01-09-2016","01-07-2016","one time date","01-09-2016","No Repeat","9 Hours","View","X","",""
Try this for me. Delete your dat file, create a new one time date reminder and then immediately look in the data file. What does it say the name of the file is?
Deleted the dat file and started over did the same thing, new fresh dat file
Contents of dat file before changing date
2,10,1
"File Name","Entry Date","Reminder Description","Time/Date","Reminder Type","Next Reminder","Open","Delete","Delay","Notifications"
"1d20160107155942.rtf","01-07-2016","one time date","01-08-2016","No Repeat","9 Hours","View","X","",""
what else can be tried ?
Let's make sure that you are doing exactly what I am so tell me if you do something different from this.
1.    Delete the dat file
2.    Run the app and create the dat file
3.    click "New Reminder"
4.    enter "one time date" in the reminder name
5.    choose "One Time Date" as the reminder type
6.    click "Save" and then "OK"
7.    click the Date/Time cell of the reminder
8.    select Jan 9
9.    click "View"
5.    choose "One Time Date" as the reminder type
entered detail into the rtf the only difference
entered detail into the rtf the only difference only on creation
That seems to make no difference:(

To track this down we'll need to do some debugging.
1.    Start again creating a new file
2.    Press break (ctrl+break)
3.    Select Debug->Add Watch... from the menu
4.    create a Watch that looks like this

User generated image5.    click OK
6.    run the app and it will stop twice showing you what's in the cell. Click Continue (F5) each time.
7.    create the one time reminder, change it's date, and click View. If the app stops somewhere in the process and the value in the watch window doesn't start with "1d" tell me what you were doing at the time.
8.    If and when it fails, click the Call Stack button (ctrl+L) and take a picture of it for me.
had To run an errand,back now i will try
i think its here:
 If gintRowClicked > 0 Then
       Debug.Print .TextMatrix(gintRowClicked, gintColClicked) = Format(DateSerial(Year(GridDate), Month(GridDate), gintlblDayIndex - firstday), "mm-dd-yyyy")
       
            .TextMatrix(gintRowClicked, gintColClicked) = Format(DateSerial(Year(GridDate), Month(GridDate), gintlblDayIndex - firstday), "mm-dd-yyyy")
        End If
debug.prints False
The watch displays
Change:   :        frmReminder.Gridmaster.TextMatrix(1, 0) : "01-20-2016" : String : frmCalendar.Form_Unload
never used watch before hope this helps
To learn more about debugging read my Using the VB6 Debugger article. If you find it helpful click the Good Article button.

From the information you posted it looks like that somehow either gintColClicked is being set to 0 or it never gets set at all and keeps it's initial zero value. In any case we now never put the calendar date anywhere but in column 3 so change

.TextMatrix(gintRowClicked, gintColClicked) = Format(DateSerial(Year(GridDate), Month(GridDate), gintlblDayIndex - firstday), "mm-dd-yyyy")

to

.TextMatrix(gintRowClicked, GRD_TIME_DATE) = Format(DateSerial(Year(GridDate), Month(GridDate), gintlblDayIndex - firstday), "mm-dd-yyyy")

I think that will fix the problem but test adding a new reminder, etc to see if everything else works.
Tried again added a debug to frmCalendar unload changed the date from 01-08-2016 to 01-12-2016
 If gintRowClicked > 0 Then
            .TextMatrix(gintRowClicked, gintColClicked) = Format(DateSerial(Year(GridDate), Month(GridDate), gintlblDayIndex - firstday), "mm-dd-yyyy")
            Debug.Print frmReminder.gridMaster.TextMatrix(1, 0)
        End If
debug.returned 01-12-2016
thanks seems to work with last code you posted
I was ready to say make that column non-editable
they could delete the row and make a new reminder
Got any tips on testing Weekly, Monthly, Yearly reminders ?
For each type I would
- Add one
- Change the date
- View it
- Delete it
- Etc
I was referring to what happens when one becomes due
Can it be marked as done ?
Will the msgbox stay on the screen until user does something or  ?
guess i will just to wait and see.
don't want to have all the issues we had with had with AMPM reminders
ran into another issue
When creating a new reminder and not putting any info just clicking the X to unload the form
i get this
User generated image

user should be able cancel without any prompts by clicking Cancel or the X on the form
Just click the "OK" button on the msgbox and then click the "Cancel" button on the form just as you would if you had entered valid data but changed your mind about creating the reminder.
yes, but no prompt should show if nothing has been done either through the X or the cancel
only prompt if data is partially filled out
So what should I do if they don't do anything except click Save?
then a prompt is necessary
txtName and cboType are the only requirements. right ?
if either is not done and Save is clicked then a prompt
That's what I'm doing now.
while your add it and new reminder is saved then automatically save the grid
only time prompt for changes is if col 2 is edited. date/time column changes save automatically
with no prompt
Is you last post no longer about frmTaskDetails? If so please tell me specifically what to do after Save is clicked on that form and the user has not filled in anything. If you tell me that there should be no message displayed in that situation then I have to say that's not good style because consider the user. Because he has no information to the contrary he may think that pressing Save in that situation will create a reminder, and when he sees that it hasn't he will wonder what happened to it.
in frmTaskDetails txtName and cboType are required to save
In frmTaskDetails if user click save without entering required data then it will not be saved
msgBox "You must enter text name and select a Reminder Type to save"
Save will only work if txtName and cboType are entered
if the requirements are met the Then clicking Save will the add data to frmReminder gridMaster
as it does now
the grid is then saved this will stop the prompt to save changes in frmReminder
OK I think you are saying that if I add a message that says "You must enter Reminder Type and select a Reminder Type in order to save the reminder" when they are both blank, that you are OK with the process and you've changed your mind about what you said above which wax "user should be able cancel without any prompts by clicking Cancel or the X on the form". Please confirm.
Yes Only save when Reminder Type and select a Reminder Type are filled in.
Do not save if they are not
Are you still with me ?
Yes, working on the bug that happens if frmNotifications tries to open and a modal form is already open.
ok good
OK, that was a tough nut. This release includes...
Fixed a bug where you were getting an error when starting with a new dat file, adding a one-time date reminder, changing the date, and clicking View, you would get a file not found msg
Added a "No alerts for today" to frmNotifications and added a better way of making sure that it only shows up once a day
Added code to handle the situation where frmTaskDetails is open and the time to show frmNotification shows up which would otherwise result in a Runtime Error '401': Can't show non-modal form when modal form is displayed."
Cleaned up frmOptions and associated stuff that wasn't being used.
28910123d.zip
found a couple bugs the notifaction says not due today, but there is a ampm reminder due
User generated imageWhen a reminder pops up clicking done should do this:
Save the rtf file to the deleted folder
remove the row from the grid
The confirmation msgbox should have the text in column 2 not the filename
i clicked done and got this error
User generated imagealso after creating a new reminder and its added to  the grid the grid should be saved and no prompt
when unloading frmReminder
also still getting this when creating a new reminder and clicking the X on the form without filling in information
User generated image
also still getting this when creating a new reminder and clicking the X on the form without filling in information
I asked you in post ID: 4140392 if that's what you wanted to do and in the ext post you said yes. As fara as I'm concerned the only thing wrong is the msg caption.
Your comments in post ID: 41404856 don't make any sense to me. You show a picture of an alert and then you talk about about stuff that has nothing to do with that alert so please explain whet you mean.
I will try to explain better
2 thing are needed to have a valid saved reminder
1. The Text for a description
2.The reminder type
User clicks newReminder the deatail form opens
User does not enter any data, just clicks the X to unload the form or clicks cancel.
if no data is entered just unload the form with no prompts.
Only prompt if user has entered partial data  prompt if either cancel or the X on the form
if both requirements are met the the data is added to the grid in frmreminder the rtf file saved
and the grid saved and no prompt when existing the form
let me know if this is unclear

The Notification bug
it says there are no reminders do today when there is One
the One time 396 should be on the list.

Clicking Done on a one time reminder
Form Pops up for a No Repeat AMPM Time reminder notifying you of a reminder due
you have already done so you click done.
This needs to happen when clicking done.
The rtf file is moved to deleted items folder
The row removed from the grid and the grid saved

 
As fara as I'm concerned the only thing wrong is the msg caption.
yes and the form should unload when clicking OK
2 thing are needed to have a valid saved reminder
1. The Text for a description
2.The reminder type
User clicks newReminder the deatail form opens
User does not enter any data, just clicks the X to unload the form or clicks cancel.
if no data is entered just unload the form with no prompts.
Only prompt if user has entered partial data  prompt if either cancel or the X on the form
if both requirements are met the the data is added to the grid in frmreminder the rtf file saved
and the grid saved and no prompt when existing the form
let me know if this is unclear
I understand that if the user starts to add a new reminder and doesn’t add a a Reminder name or a Reminder type and clicks the X or clicks Cancel you want to unload the form with no prompts. I think that at least a message that says “No reminder created, do you want to cancel?” with Yes/No choices should be shown.

The Notification bug
it says there are no reminders do today when there is One
the One time 396 should be on the list.
No. Time reminders are show separately on a similar form but only if there is a notification set up for the reminder.
Clicking Done on a one time reminder
Form Pops up for a No Repeat AMPM Time reminder notifying you of a reminder due
you have already done so you click done.
This needs to happen when clicking done.
The rtf file is moved to deleted items folder
The row removed from the grid and the grid saved
This has noting to do with notifications and I believe what you are saying already happens when frmDeferTime shows up.
only if there is a notification set up for the reminder
.
there should be no requirements
This has noting to do with notifications and I believe what you are saying already happens when frmDeferTime shows up.
don't think it removed the row from the grid i will have try again
OK
Lets do this if user clicks new reminder and opens frmDetails and does not enter any data at all and clicks the X on the form or cancel the a msgbox No Reminder created with just an ok button
Clicking ok unloads the form and frmReminders ia shown

 if user clicks new reminder and opens frmDetails and enters partial information then
Msgbox "you did not enter all the required data for a reminder"
Click ok to continue with entering more data, no reminder will be made"

Click Cancel to continue to enter data
Sorry about the confusing post next time i will post each bug in a separate post
When I said
only if there is a notification set up for the reminder
and you said
there should be no requirements
I believe you are confusing two different processes. The first process happens when a time reminder's time is reached and this form shows up.
User generated imageHowever if early in the morning you had created a one-time time reminder for 11:13 AM and added a notification for that reminder to go off at 4 hours prior to the reminder time then this would show have show up before the reminder's time is reached at 7:13.
User generated imageDo you understand the difference?
Yes i see the difference, but should they both be on the list in Alerts for Today ?
Ran into another issue was not notified of a yearly reminder that is set For Jan10th set a couple days ago
User generated image
Yes i see the difference, but should they both be on the list in Alerts for Today ?
What are you referring to when you say "both"?
Please attach the dat file that contains the Jessicas Birtday reminder.
What are you referring to when you say "both"?
There Is only one at 11:13 should it not be on the list of Remiders due today
rename the attached dat file
FlexGrid.txt
The following are two lines from the dat file
"1d20160108160150.rtf","12-23-2016","Renew Tracphone minutes","12-23-2016","No Repeat","347 Days","View","X","","6:0|:-1|:-1"
"Yr20160108160317.rtf","01-08-2016","Jessicas Birthday","01-10-2016","Yearly","365 Days","View","X","",""

In the first line the "Notifications" column contains  "6:0|:-1|:-1" which indicates that there's a notification set to go off 6 days prior to "12-23-2016"

In the second line (Jessicas Birthday) the "Notifications" column is blank so there are no notifications set and so it should not show up on the Daily Alerts.

Now concerning your "both be on the list in Alerts for Today" question. The Alerts for Today is designed to show up just one each day and show those date-based reminders whose reminder date minus the notification period equals today. Because the Alerts for Today shows up just once each day IMO it doesn't make sense to have time-based reminders on that report. I could change that if you like but the way I have it designed, the time-based alerts show up individually on their own Alert forms.
in jessica the "Notifications" column is blank do you know how this could happen ?


 Maybe make it clear is not for times only dates.
Its confusing if you have a time reminder due today and a list says 'no reminders due"
how this could happen ?
Four ways:
1.    You didn't add a notification
2.    After creating it you added a notification via "View" but you didn't save it
3.    While testing you used "View" and clicked the "X" next to the notification
4.    There's a bug
How can it be fixed where it cannot happen ?
I showed you 4 ways it could happen so don't understand what you mean.
Evidently The grid gets saved with the missing info, maybe write code to check grid save code
and not allow saving and force the missing info to be given if missing
How do you define "missing" since after adding a notification it might have been the user's intention to delete it?
need to find a way to fix the issue, have a reminders that do not remind are wortless.
What do you recommend ?
I think that if a user Deletes a reminder by clicking the x then  reminder  time/date should be the selected date/time and if missing the save will fail
I  set a No Repeat Date Reminder yesterday for today. it was not on the screen this am. attached the dat fileFlexGrid.txt
To resolve some of the problems I'm going to make a couple of major changes to the code and it may take me a couple of days to check it out.
ok good
OK I think I've got this and unless you find something major I'd like to move on. Included in this release:
Changed code to check for the existance of the ini file at app start rather then when frmOptions loads
Added a new "Last Run" value to the ini file that get's updated when the app is closed. This allows the "Alerts" form to be shown when the app is restarted, even if the normal time for that to happen has passed. Note that that the alerts may not show if you close the app using the little, square, End button in the IDE (see testing notes below)
Changed "Alerts for Today" &  "Daily Alert" to "Date Alerts for Today" and "Time Alert"
Changed msgbox message when X'ing out of frmTaskDetails without having entered any data

Testing Notes:
To test the problem you reported in post ID: 41406636
1.    Create a reminder for tomorrow
2.    Close the app, saving the data
3.    Edit the dat file changing the Time/Date value for the new reminder to today's date
4.    Edit the ini file changing the Last Run value to yesterday's date. That will simulate you having created the reminder yesterday.
5.    Restart the app. The Daily Alert form should show up within 10 seconds and not show up again until tomorrow
28910123e.zip
add to testing
6.change notification time in options to a later time than current.
My instructions were for a date-based reminder without notifications.
Sill need to fix this small issue. after creating a new reminder the grid should be saved and this prompt elimanted. only used for editing column 2
User generated image
Included:
Changed code to check for the existance of the ini file at app start rather then when frmOptions loads
Added a new "Last Run" value to the ini file that get's  updated when the app is closed. This allows the "Alerts" form to be shown when the app is restarted, even if the normal time for that to happen is passed. Note that that the alerts may not show if you close the app using the little, square, End button in the IDE
Changed "Alerts for Today" &  "Daily Alert" to "Date Alerts for Today" and "Time Alert"
Changed msgbox message when X-ing or Cancel-ing out of frmTaskDetails without having entered any data
Changed code to save silently when a new reminder is created
28910123f.zip