Solved

Date comparison syntax in MS Access 2003

Posted on 2012-04-05
4
272 Views
Last Modified: 2012-12-02
I have to fields in a DB both holding different syntax for date/time and I need to compare them with one another finding when they are not the same

Sample set of data:

DATETIME_OF_ENTRY : 201203201719
TRANSACTION_D_T : 03/20/2012 05:19PM

what I want to do is find situations where this is the case:
DATETIME_OF_ENTRY : 201203211719
TRANSACTION_D_T : 03/20/2012 05:19PM
(where the two fields differ)
0
Comment
Question by:markloessi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 37814052
use this expression in a query


 Format(Mid([DATETIME_OF_ENTRY], 5, 2) & "/" & Mid([DATETIME_OF_ENTRY], 7, 2) & "/" & Left([DATETIME_OF_ENTRY], 4) & " " & Mid([DATETIME_OF_ENTRY], 9, 2) & ":" & Right([DATETIME_OF_ENTRY], 2), "mm/dd/yyyy hh:nnAMPM")

that will format the field  [DATETIME_OF_ENTRY] in the same format as the field  [TRANSACTION_D_T]
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 37814285
Use this criteria:

Select * From tblYourTable
Where [DATETIME_OF_ENTRY] <> Format([TRANSACTION_D_T], "yyyymmddhhnn")

/gustav
0
 

Author Closing Comment

by:markloessi
ID: 37818146
Both these solutions actually helped with the end result, as is often the case until you see the solution you sometimes don't actually know what you need.

Thanks!
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 37818527
You are welcome!

/gustav
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question