A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date query



 
 
Thread Tools Display Modes
  #1  
Old November 4th, 2008, 11:57 PM posted to microsoft.public.access
Bob Vance
external usenet poster
 
Posts: 726
Default Date query


I wanting to show the date as last day of the previous month from
[InvoivceDate] in my text box
=Format([InvoiceDate],"dd-mmm-yyyy")
--
Thanks in advance for any help with this......Bob
MS Access 2007 accdb
Windows XP Home Edition Ver 5.1 Service Pack 3


  #2  
Old November 5th, 2008, 12:45 AM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Date query

Bob

To get the last day of the previous month, there's a trick you can use with
the DateSerial() function. By using the "0" (zero-th) day of THIS month,
Access will determine the last day of last month.

Your expression might look something like:

DateSerial(Year(Date()), Month(Date(), 0)

This will use today's date (the Date() function) to get the year and month
of today's date, then step back to the last day of the previous month.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Bob Vance" wrote in message
...

I wanting to show the date as last day of the previous month from
[InvoivceDate] in my text box
=Format([InvoiceDate],"dd-mmm-yyyy")
--
Thanks in advance for any help with this......Bob
MS Access 2007 accdb
Windows XP Home Edition Ver 5.1 Service Pack 3




  #3  
Old November 5th, 2008, 01:21 AM posted to microsoft.public.access
Bob Vance
external usenet poster
 
Posts: 726
Default Date query

Thanks Jeff , can i use ([InvoiceDate]) for this code in my text box on a
Report
Regards Bob

"Jeff Boyce" wrote in message
...
Bob

To get the last day of the previous month, there's a trick you can use
with the DateSerial() function. By using the "0" (zero-th) day of THIS
month, Access will determine the last day of last month.

Your expression might look something like:

DateSerial(Year(Date()), Month(Date(), 0)

This will use today's date (the Date() function) to get the year and month
of today's date, then step back to the last day of the previous month.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Bob Vance" wrote in message
...

I wanting to show the date as last day of the previous month from
[InvoivceDate] in my text box
=Format([InvoiceDate],"dd-mmm-yyyy")
--
Thanks in advance for any help with this......Bob
MS Access 2007 accdb
Windows XP Home Edition Ver 5.1 Service Pack 3






  #4  
Old November 5th, 2008, 04:44 AM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Date query

On Wed, 5 Nov 2008 14:21:50 +1300, "Bob Vance" wrote:

Thanks Jeff , can i use ([InvoiceDate]) for this code in my text box on a
Report


If you want the last day of the month prior to InvoiceDate, use

=DateSerial(Year([InvoiceDate]), Month([InvoiceDate]), 0)

This will give September 30 if run on October 31... not clear if that's what
you want!
--

John W. Vinson [MVP]

  #5  
Old November 5th, 2008, 09:30 AM posted to microsoft.public.access
Bob Vance
external usenet poster
 
Posts: 726
Default Date query

Brilliant thanks John

"John W. Vinson" wrote in message
...
On Wed, 5 Nov 2008 14:21:50 +1300, "Bob Vance" wrote:

Thanks Jeff , can i use ([InvoiceDate]) for this code in my text box on a
Report


If you want the last day of the month prior to InvoiceDate, use

=DateSerial(Year([InvoiceDate]), Month([InvoiceDate]), 0)

This will give September 30 if run on October 31... not clear if that's
what
you want!
--

John W. Vinson [MVP]



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.