Solved

Date comparison syntax in MS Access 2003

Posted on 2012-04-05
4
264 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 119

Assisted Solution

by:Rey Obrero
Rey Obrero 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now