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  

Question about Date validation



 
 
Thread Tools Display Modes
  #1  
Old March 15th, 2007, 07:20 PM posted to microsoft.public.access.forms
NoviceNana
external usenet poster
 
Posts: 3
Default Question about Date validation

Hi All,

I'm working on a form for weekly data entry. I'd like to create a
date field where the user will enter the date the week ends (ie week
ending Friday, June 25th). Is there a way to write code so that
Access will check that the day the user inputs is a Friday (and if not
they will recieve an error message)?. I know how to program the
error message pop-up box, but I have no idea how to write code to
check if the date inputted is a Friday.

Any help would be greatly appreciated!
Thanks

  #2  
Old March 15th, 2007, 07:57 PM posted to microsoft.public.access.forms
Ofer Cohen
external usenet poster
 
Posts: 1,683
Default Question about Date validation

Use the WeekDay function

If WeekDay(Me.DateField) = 6 Then
MsgBox "Error"
End If
--
Good Luck
BS"D


"NoviceNana" wrote:

Hi All,

I'm working on a form for weekly data entry. I'd like to create a
date field where the user will enter the date the week ends (ie week
ending Friday, June 25th). Is there a way to write code so that
Access will check that the day the user inputs is a Friday (and if not
they will recieve an error message)?. I know how to program the
error message pop-up box, but I have no idea how to write code to
check if the date inputted is a Friday.

Any help would be greatly appreciated!
Thanks


  #3  
Old March 15th, 2007, 09:19 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 1
Default Question about Date validation

On Mar 15, 3:57 pm, Ofer Cohen
wrote:
Use the WeekDay function

If WeekDay(Me.DateField) = 6 Then
MsgBox "Error"
End If
--
Good Luck
BS"D



"NoviceNana" wrote:
Hi All,


I'm working on a form for weekly data entry. I'd like to create a
date field where the user will enter the date the week ends (ie week
ending Friday, June 25th). Is there a way to write code so that
Access will check that the day the user inputs is a Friday (and if not
they will recieve an error message)?. I know how to program the
error message pop-up box, but I have no idea how to write code to
check if the date inputted is a Friday.


Any help would be greatly appreciated!
Thanks- Hide quoted text -


- Show quoted text -


Excellent! Thanks so much!

  #4  
Old March 16th, 2007, 02:07 AM posted to microsoft.public.access.forms
missinglinq via AccessMonster.com
external usenet poster
 
Posts: 545
Default Question about Date validation

Since you want to throw an error message if the date IS NOT a Friday,
shouldn't it be

If WeekDay(Me.DateField) 6 Then
MsgBox "Error"
End If

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

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 02:03 AM.


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