Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / September 2006

Tip: Looking for answers? Try searching our database.

vbSunday

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sandrao - 29 Sep 2006 15:38 GMT
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.
Sprinks - 29 Sep 2006 19:35 GMT
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

> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.