Solved

Date comparison syntax in MS Access 2003

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
Familiarize people with the process of utilizing SQL Server views 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 Access…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…

749 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