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
Solved

Date comparison syntax in MS Access 2003

Posted on 2012-04-05
4
270 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
  • 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 49

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 49

Expert Comment

by:Gustav Brock
ID: 37818527
You are welcome!

/gustav
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

808 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