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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Force date to the first day of the month



 
 
Thread Tools Display Modes
  #1  
Old June 17th, 2008, 08:57 PM posted to microsoft.public.access.forms
Lee Zard via AccessMonster.com
external usenet poster
 
Posts: 5
Default Force date to the first day of the month

I have a form bound to a table with a text box for clients to enter a date.
The date is formatted to mmmm yyyy because reporting is based only on month
and year. Occasionally a client will enter a date including the day. This
throws off the Group By in my reporting. Is there a way to force the day to
always be 1?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200806/1

  #2  
Old June 17th, 2008, 09:34 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Force date to the first day of the month

Occasionally a client will enter a date including the day. Is there a way
to force the day to always be 1?
I would recommend using a DateTime field instead of a text field. I think
that would solve your problem.


--
KARL DEWEY
Build a little - Test a little
  #3  
Old June 17th, 2008, 09:59 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Force date to the first day of the month

On Tue, 17 Jun 2008 19:57:54 GMT, Lee Zard via AccessMonster.com
wrote:

I have a form bound to a table with a text box for clients to enter a date.
The date is formatted to mmmm yyyy because reporting is based only on month
and year. Occasionally a client will enter a date including the day. This
throws off the Group By in my reporting. Is there a way to force the day to
always be 1?


On the form, code the date control's AfterUpdate event:
Me.[DateControlName] =
DateSerial(Year([DateControlName]),Month([DateControlName]),1)

All dates, when entered, will be as of the 1st of that entered month.

You'll need to run an update query to change previously entered data.

Update YourTable Set YourTable.[DateField] =
DateSerial(Year(DateField]),Month(DateField]),1)
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #4  
Old June 18th, 2008, 01:51 PM posted to microsoft.public.access.forms
Lee Zard via AccessMonster.com
external usenet poster
 
Posts: 5
Default Force date to the first day of the month

Exactly what I needed. Thanks!

--
Message posted via http://www.accessmonster.com

 




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 08:56 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.