Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2003, 11:02 AM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to juliya_sh
Default vb and sql

hello,
i need get the field-date in specific format by sql in the vb
i know it something as dateformat but i didn't know
how i do it.
can somebody help ?
thanks

 
Old July 9th, 2003, 06:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There's heaps of different ways you can format dates, whether it be through the format expression - eg: Format([FieldName],'Medium Date')

or whether you extract parts of the date and then re-arrange them
eg:

DatePart('yyyy',FieldName) & "/" & DatePart('m',FieldName) & "/" & DatePart('d',FieldName)

You can even combine them, such as:

UCase(Left(Format([FieldName],'Medium Date'),7)) & DatePart('yyyy',[FieldName])

If you want your medium date to be 01-NOV-1998 rather than 01-Nov-98

All those examples work in both queries and VBA

If you're still unsure, let me know the exact format you want the date in, and I'll let you know how to format it.

Steven

There are 10 kinds of people in the world - those who understand binary - and those with friends





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with VB SQL Server 7.0 danfeather VB Databases Basics 2 September 23rd, 2005 09:58 AM
Help! At a lose: SQL and VB xgbnow Pro VB Databases 2 June 9th, 2004 10:12 PM
vb and sql juliya_sh Access VBA 2 July 9th, 2003 06:53 PM
ms Project,vb,sql m_ctrl VB How-To 0 June 28th, 2003 10:36 AM
ms project,sql,vb m_ctrl Pro VB 6 0 June 28th, 2003 10:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.