Date for 1st day of the week

M

mcsrta

I have a database that have a date field for the first day of the week for
the current week. How can I get access to put the first day of the week
(Mondays Date) in that field automatic for each new record for that week.
The date should change each Monday automatic.

Also, I have a number field that I want to increment by one automatic for
each new record.
 
J

John W. Vinson

I have a database that have a date field for the first day of the week for
the current week. How can I get access to put the first day of the week
(Mondays Date) in that field automatic for each new record for that week.
The date should change each Monday automatic.

Also, I have a number field that I want to increment by one automatic for
each new record.

You're using a Form to enter data, I hope - you'll need to, tables don't have
any usable events!

In the Form's BeforeInsert event put code like:

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtFirstDayOfWeek = DateAdd("d", 2-Weekday(Date()), Date())
Me!txtSequentialNumber = NZ(DMax("[SequentialNumber]", "[tablename]")) + 1
End Sub


John W. Vinson [MVP]
 
Top