Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Access To CSV Incorrect Time
Teeka Leone 
     
4 years ago
Hi! I've been struggling with this for months. I've been through all of the date/time courses here and all over the internet and I'm not finding anything.
In my SQL Server table the [SchedTime] field datatype = datetime
Looking at the table in SQL Server the data looks like this:
1899-12-30 17:30:00.000.  (not desired format)
In the Access query that fills the form Adam helped me create a column alias using Time Value where the SchedTime looks like: 5:30 PM (WHICH IS PERFECT)
When I Export the form data to CSV even the aliased column using timevalue shows as  [12/30/1899 17:30:00]
How can I handle this in VBA so that the export is formatted correctly (5:30 PM)?  In my project, a third party APP needs to consume the CSV file and map appropriately to its time field.  Any thoughts on how I can force this formatting into the CSV?
Kevin Yip  @Reply  
     
4 years ago
You need to output the time as a string, so the CSV will get exactly what the string looks like.  Try exporting a query like the one below to CSV:

SELECT Format([timefield1],"h:nn am/pm") AS timefieldstr FROM Table1;
Scott Axton  @Reply  
        
4 years ago
Yep what Kevin said.
See the Format Function page in the Glossary for more info.
Teeka Leone OP  @Reply  
     
4 years ago
Thank you Kevin and Scott.  That didn't work. Access and/or SQL completely ignored the formatting statement.  BUT, Adam (Yoda) was able to help!  it was a two step process:   1. Convert the field in the recordset to string then change the datatype in the temp table for the csv dump to text and Voila!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 12:37:42 PM. PLT: 1s