Results 1 to 6 of 6
  1. #1
    Western_Neil is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2016
    Location
    Calgary, AB
    Posts
    147

    Handling nonspecific dates

    Hello

    I have two questions about dates, Is there a way of setting up the tables, fields and relationships so that a nonspecific date can be used with dates?

    I have historical data the can gives dates as early July, near, by, on, later etc. I can handle this by guessing but that’s changing the data which should be NO. Adding a field to indicated that its nonspecific doesn’t help the ordering of the dates. All ideas are welcomed.

    The second one I will post on a new thread.



    Thanks Neil

  2. #2
    nrgins's Avatar
    nrgins is offline some guy
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    62
    Hello, Western Neil! Southwestern Neil here. :-)

    To answer your question, no, you can't use a date field for that. You'd have to use a text field.

    However, you can create a SECOND field as a date field which has your guess as to what the date is, and use that for sorting. That way, you don't change the actual data, and you still have a date you can sort by.

  3. #3
    Western_Neil is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2016
    Location
    Calgary, AB
    Posts
    147
    Thanks Neil

    I like it. If I also add an accuracy field that should handle it for what I need. An example of what I'm thinking would be
    2016/7/15 (date) .. 15 (+- days) ... Mid July 2016 (The real vaule). With a firm date being
    2016/7/4 (date) .... 0 (+- days) ... 4 Jul 2016.

    The only hang up is entering the extra data, but with smart forms that should handle it.

    Neil

  4. #4
    nrgins's Avatar
    nrgins is offline some guy
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    62
    Yeah, two things you can do in your form. Let's say your fields are called DateValue, Accuracy, and RealValue. In your DateValue control's After Update event, you can put:

    Code:
    Me.Accuracy = 0
    Me.RealValue = Me.DateValue
    This way, if you have an actual date value, the Accuracy and RealValue values would be automatically completed for you when you complete the DateValue field.

    The problem with that approach is that then you'd be going back and forth between entering actual dates in the DateValue field and non-actual dates in the RealValue field. Not only would that be annoying, it might also lead to data errors (although DateValue being a Date field won't allow non-date values, so that would help).

    Another approach would be to always use the RealValue field for data entry, and have the form decide if it's an actual date or not. Thus, in the RealValue control's After Update event, you'd do:

    Code:
    If IsDate(Me.RealValue) Then
        Me.DateValue = Me.RealValue
        Me.Accuracy = 0
    Else
        Me.DateValue.SetFocus
    End If
    That places the cursor in the DateValue field if the RealValue field doesn't contain a date value.

  5. #5
    Western_Neil is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2016
    Location
    Calgary, AB
    Posts
    147
    Thanks
    Both are good ideas, and I will probably use the second one
    Thanks Neil

  6. #6
    nrgins's Avatar
    nrgins is offline some guy
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    62
    You're welcome, Neil.

    (Neils FTW!)

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

Similar Threads

  1. Replies: 8
    Last Post: 12-02-2013, 03:46 PM
  2. Query input dates for range of dates in two fields
    By kagoodwin13 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 04:25 PM
  3. Replies: 3
    Last Post: 02-12-2012, 06:05 PM
  4. Error Handling
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 09-14-2010, 12:17 PM
  5. Handling dates in queries
    By mrk68 in forum Access
    Replies: 4
    Last Post: 03-23-2009, 06:35 AM

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