Date for 1st day of the week

G

Guest

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top