Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 39
  1. #16
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917

    As you could see in my code, if there was no date at the end of the Details field the code returns the date 1/1/1900. Is that acceptable?

  2. #17
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    As you could see in my code, if there was no date at the end of the Details field the code returns the date 1/1/1900. Is that acceptable?

  3. #18
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101
    Thanks RuralGuy for pointing that out, I am in the process of learning VBA.

  4. #19
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101
    Well this will not work in some cases, I most likely have updated that record to the correct date of that entry. So, if there is not date leave that records date as is and move on.

  5. #20
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    We can set it up to use the original field date if there is no date at the end of the Details field. Is that acceptable?

  6. #21
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101
    That would be acceptable!

  7. #22
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Hmm...something fishy with the data. It may take a bit.

  8. #23
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    The date at the end of the Memo field is preceeded by Chr(160) and not a space. Will that always be consistant?

  9. #24
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101
    For the memo fields with the date on the end, I would say they would be consistant, they all were copied from the same website, so yes!
    The other rows without the dates were either copy and paste or hand typed.

  10. #25
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101
    I am curious how you discovered this fact?

  11. #26
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Quote Originally Posted by bigroo View Post
    I am curious how you discovered this fact?
    My code was not finding the first *SPACE* before the date. It instead was going further back into the memo field. Then it was simply a matter or decoding those bytes.

  12. #27
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I don't think it is a space before the date in your details field. I'm finding chr 160.

    I ran this query
    Code:
    SELECT 
      tblFacHistory.[Date Started]
    , tblFacHistory.Details
    , InStrRev([details],Chr(160)) AS x
    FROM tblFacHistory
    WHERE
     (((tblFacHistory.Details) Like "*" & Chr(160) & "*"));
    and this is a portion of what I received.

    Code:
    Date Started Details x
    4/4/2012 New Rock 90.7 from The Alternative 6/26/2003 35
    4/4/2012 Religious from cp-new 7/26/2011 22
    4/4/2012 cp-new from 7/23/2008 13
    4/4/2012 Radio 74 Internationale from 7/26/2011 30
    4/4/2012 KGHWFM from 177344FM 9/17/2010 21
    4/4/2012 90.7 from 90.9 3/11/2009 15
    4/4/2012 Black Hills State University from Educational Media Foundation, Inc. 6/2/2009 69
    4/4/2012 Educational Media Foundation, Inc. from American Family Association 3/27/2007 68
    4/4/2012 Adult Altern. from cp-new 4/13/2009 26
    4/4/2012 The Buzz from 4/13/2009 15

  13. #28
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    The update query would be

    Code:
    UPDATE tblFacHistory 
    SET [Date Started] = Mid([details],InStrRev([details],Chr(160)))
    WHERE (((Details) Like "*" & Chr(160) & "*"));
    7383 records would be updated.

  14. #29
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101
    Hi Orange,

    I am curious what does the numbers under column X indicate?

  15. #30
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Quote Originally Posted by bigroo View Post
    Hi Orange,

    I am curious what does the numbers under column X indicate?
    That is the position in the field Details where the Chr(160) occurs.

    In fact it is the character before the start of the Date in those Detail records that have the Date.
    So the Date we are looking for (to do the update) is between that x position and the end of the Details field.

    I have revised the select query to show what would be used to update the Date Started. I called it ToReplace

    Here's the query
    Code:
    SELECT [Date Started]
    , Details, InStrRev([details],Chr(160)) AS x
    , Mid([details],InStrRev([details],Chr(160))) AS ToReplace
    FROM tblFacHistory
    WHERE (((tblFacHistory.Details) Like "*" & Chr(160) & "*"));
    and here's some sample output

    Date Started Details x ToReplace
    4/4/2012 New Rock 90.7 from The Alternative 6/26/2003 35 6/26/2003
    4/4/2012 Religious from cp-new 7/26/2011 22 7/26/2011
    4/4/2012 cp-new from 7/23/2008 13 7/23/2008
    4/4/2012 Radio 74 Internationale from 7/26/2011 30 7/26/2011
    4/4/2012 KGHWFM from 177344FM 9/17/2010 21 9/17/2010
    4/4/2012 90.7 from 90.9 3/11/2009 15 3/11/2009
    4/4/2012 Black Hills State University from Educational Media Foundation, Inc. 6/2/2009 69 6/2/2009
    4/4/2012 Educational Media Foundation, Inc. from American Family Association 3/27/2007 68 3/27/2007
    4/4/2012 Adult Altern. from cp-new 4/13/2009 26 4/13/2009
    4/4/2012 The Buzz from 4/13/2009 15 4/13/2009
    4/4/2012 KJKTFM from KOARFM 3/26/2009 19 3/26/2009
    4/4/2012 KOARFM from KSPFFM 5/4/2007 19 5/4/2007
    4/4/2012 KSPFFM from 92516FM 4/26/2006 20 4/26/2006
    4/4/2012 Calvary Chapel of Twin Falls, Inc. from CSN International 11/5/2007 58 11/5/2007
    4/4/2012 Religious from cp-new 3/10/2008 22 3/10/2008
    4/4/2012 CSN International from The Cause 12/1/2008 33 12/1/2008
    4/4/2012 The Cause from 3/10/2008 16 3/10/2008
    4/4/2012 KWRCFM from 90500FM 3/16/2005 20 3/16/2005

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. how to extract month and year from date column
    By penguinwebsoft in forum Queries
    Replies: 5
    Last Post: 10-11-2012, 11:29 PM
  2. extract something from a field
    By tozey in forum Queries
    Replies: 4
    Last Post: 02-24-2012, 08:54 AM
  3. Query to extract maximum figures for each date
    By vijanand1279 in forum Queries
    Replies: 2
    Last Post: 11-03-2011, 10:41 PM
  4. Extract two last recodes
    By yosik20 in forum Queries
    Replies: 4
    Last Post: 04-12-2011, 01:35 PM
  5. Extract Creation/Last Edit Date
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 02-15-2011, 07:12 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