Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 June 10th, 2004, 11:49 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default using format function in a query

Hello,

I'm wondering why I'm getting an error when entering "format" into the field name of a query. I'm trying to get the month name from a date by using the following code:

MonthName: Format([DateOrdered], "mmmm")

When I try to run the query, I get an error message:

"undefined function 'Format' in expression"

Thanks in advance for any help.
 
Old June 10th, 2004, 12:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check to make certain that all your references are properly linked and that the VBA library is indeed referenced.



Rand
 
Old June 17th, 2004, 12:51 AM
Authorized User
 
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Make sure it is a "Crosstab Query" & not a "Select Query". From Query toolbar, select Crosstab Query.
I believe, this might be the problem.
Good Luck either way!

 
Old June 26th, 2004, 01:22 AM
Authorized User
 
Join Date: Jun 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

   I don't think that Format is Formating function in SQL (SQL SERVER); might be, it uses for formating data or else ... i have been using format_file etc. for formating file etc...

I have also tried now on to use

   SELECT FormatedData = Format(mmm,getdate())

   But got error that '
 Server: Msg 195, Level 15, State 10, Line 3
'Format' is not a recognized function name. '


  So, i prefered to use ...

  select convert(varchar,datepart(dd,getdate())) + '-' + convert(varchar,datepart(mm,getdate())) +'-'+ convert(varchar,datepart(yy,getdate())) As FormatedDate


   i have been using above way ... hope it will help you too...

 Stay Beautiful,

 Abdul Salam





Similar Threads
Thread Thread Starter Forum Replies Last Post
Indian Rs Format simple Function for vb.net s.karthik General .NET 0 March 24th, 2008 06:27 AM
Problem in Date Format in query imagetvr Pro VB 6 1 February 4th, 2008 06:03 PM
format-number function problem jeffbk XSLT 8 May 5th, 2007 03:20 AM
How to query Date format in Oracle samlow82 ADO.NET 1 July 18th, 2003 04:34 AM





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