Results 1 to 9 of 9
  1. #1
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74

    Question on building a reminder application

    Hi,
    As part of learning Access, I am trying to build a db to remind us of upcoming events.
    This is what I did:
    There is a table 'tblReminder' where I have these fields: EventDate, EventDescription, RemindDate, Dismiss (a check box). When you enter the date and description of an event, you also put a date in the RemindDate field. Later, when you view it on a form, the records should show up only from the RemindDate onwards.


    (Let's say that a wedding comes up on 25/04/2015. I put 20/04/2015 as the RemindDate so that I get time to buy a gift.This record should then be visible from 20/04/2015 onwards). I hope that is clear.
    How can I do this? A bit of code in the OnLoad event, perhaps?
    I'll greatly appreciate it if anyone can help me with this.
    Thanks.
    PS: What I mentioned above is just my idea. If there is a better way to do this please tell me about that. I am using Access 2010.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Event not needed.
    The main form that opens is connected to a query that pulls tReminders for Date().
    when today is 20/4/15 ,then THAT record shows.

  3. #3
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74
    Quote Originally Posted by ranman256 View Post
    Event not needed.
    The main form that opens is connected to a query that pulls tReminders for Date().
    when today is 20/4/15 ,then THAT record shows.
    Hi,
    Thanks for the reply.
    But what I want is that, the records should show not just on that day, but EVERYDAY, from a date I set.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    So let's say this is your table:

    Code:
    tblEvents
    Event_ID  Event_Date  Remind_Date  Dismiss
    1         1/1/2015    12/15/2014   -1 (checkboxes are stored as -1 for 'yes' or checked, 0 as 'no' or unchecked)
    2         2/1/2015    01/15/2014   
    3         6/1/2015    05/15/2014
    The query to pull the data you want (only record 2)

    would be

    Code:
    SELECT * FROM tblEvents WHERE Remind_Date <= Date() AND Dismiss <> -1
    Then you just base your form (assuming you're using a bound form) on this query, instead of the table.

  5. #5
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74
    That worked! Thank you very much.

    May I ask just one more question?
    Imagine there are a lot of events on the form. I want to delete some of them. There is the check box on the form. I want to select some of them, and press a button to delete them. I added a command button on the form, with the following code attached to the OnClick event:
    Private Sub cmdDelete_Click()
    Dim Dismiss As CheckBox
    Dim LResponse As Integer
    LResponse = MsgBox("This will delete the record permanently. Do you wish to continue?", vbYesNo)
    If LResponse = vbYes Then
    If Me.Dismiss = True Then
    Me.Recordset.Delete
    End If
    End If
    End Sub

    Is the code alright? If I select any one record it works perfectly, but if I select more than one only one of them is deleted. What should I do?
    Thanks.

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Personally I do not delete data from my databases if I can possibly avoid it. In your case you have two possible outcomes.

    The event date has passed or the event is cancelled.

    The first can be handled by adding another criteria to your query on the EVENT_DATE

    >= Date()

    In other words the event date is greater than or equal to today's date, and the remind date is less than or equal to today's date

    The second part of removing a cancelled event can be handled by adding another text or yes/no field to your table CANCELLED

    Then, if you have a cancelled event just check this box off and in the criteria of your query driving the form add the criteria to the CANCELLED field of

    <>-1

  7. #7
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74
    Sorry for responding late. Got a little busy with a marriage..

    Thanks for all the suggestions. Even now, I can't really understand it when you said:
    Personally I do not delete data from my databases if I can possibly avoid it.
    What is wrong with deleting records? What is the point of keeping records that we know we will never need again? Don't you think it would be a waste of space?

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    No, you never know when an old record might be useful, for instance if you have to reproduce an invoice or produce a list of events for a previous year, etc. data can always be archived at a later date but your database would have to be extremely complex and store a pretty vast amount of data before you would have to consider archiving data. In short, no, I don't think it's a waste of space. Quite the opposite, I find it space well spent to keep historical information.

  9. #9
    Ayiramala is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Dec 2014
    Location
    Kerala, India
    Posts
    74
    Thanks for pointing it out. Much appreciated.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-28-2014, 01:50 PM
  2. Question in Building an Expression
    By Dmosk319 in forum Queries
    Replies: 1
    Last Post: 03-27-2014, 07:33 AM
  3. Replies: 3
    Last Post: 10-26-2012, 03:19 PM
  4. OLE Object display application issue/question
    By CaptainCornbread in forum Access
    Replies: 2
    Last Post: 01-05-2012, 09:42 AM
  5. Access application question
    By abarin in forum Access
    Replies: 0
    Last Post: 05-26-2011, 11:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums