ACC: How to Format Dates Regardless of Regional SettingsLast reviewed: August 28, 1997Article ID: Q149095 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. When you concatenate dates into a SQL string using Visual Basic for Applications, you must use a standard US date format regardless of the Control Panel's Regional Settings on your computer. This article provides a custom function that you can use to convert any date into a US date format. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual. NOTE: Visual Basic for Applications is called Access Basic in Microsoft Access version 2.0. For more information about Access Basic, please refer to the "Building Applications" manual in Microsoft Access version 2.0.
MORE INFORMATIONTo format dates, regardless of regional settings, create a module and type the following procedure:
Function MakeUSDate(x As Variant) If Not IsDate(x) Then Exit Function MakeUSDate = "#" & Month(x) & "/" & Day(x) & "/" & Year(x) & "#" End FunctionTo test this procedure:
Open Regional Settings, select English (United States) as the Regional setting, and click OK. Restart your computer for the setting to take effect. REFERENCESFor more information about concatenating SQL strings, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q136059 TITLE : ACC: Errors Concatenating Variables or Controls (2.0, 95) |
Additional query words: how to INTL
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |