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  

vbSunday



 
 
Thread Tools Display Modes
  #1  
Old September 29th, 2006, 03:38 PM posted to microsoft.public.access.forms
sandrao
external usenet poster
 
Posts: 46
Default vbSunday

I would like to have each new record start with the first day of the week
(vbSunday) e.g. first record date would be 03-Sep-06 next record date
10-Sep-06 etc. Each time I start a new record I would like the Date to appear
in the Date field. This is for scheduling purposes. Each record equals a
scheduled event on the coming week. Each new date would have to be vbSunday
and continually add seven days fron previous date.
  #2  
Old September 29th, 2006, 07:35 PM posted to microsoft.public.access.forms
Sprinks
external usenet poster
 
Posts: 531
Default vbSunday

Sandrao,

If you won't have any missing weeks, you can make the DefaultValue for the
field equal to the max date in the table + 7:

Enter into the DefaultValue property:
=DMax("[YourDateField]","YourTable")+7

You could also set the textbox' Locked property to Yes to avoid changes. If
you wish to permit the user to enter ANY Sunday, you can use the BeforeUpdate
event of the form:

' BeforeUpdate code
If Weekday(Me![YourDateTextBox]) vbSunday Then
MsgBox "Date must be a Sunday."
Cancel = True
' Optionally set the textbox to the max date + 7 as above here
Me![YourDateTextBox].SetFocus
End If

Hope that helps.
Sprinks

"sandrao" wrote:

I would like to have each new record start with the first day of the week
(vbSunday) e.g. first record date would be 03-Sep-06 next record date
10-Sep-06 etc. Each time I start a new record I would like the Date to appear
in the Date field. This is for scheduling purposes. Each record equals a
scheduled event on the coming week. Each new date would have to be vbSunday
and continually add seven days fron previous date.

 




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 11:02 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.