Hi ,
I need to add automatically current weeks first date into a table and a text box of a vba form. could anyone help if any functions are available ??
Hi ,
I need to add automatically current weeks first date into a table and a text box of a vba form. could anyone help if any functions are available ??
I know you said VBA but here's how it can be done in Access database engine SQL and works 'stand alone' i.e. not requiring Access or VBA (of course, the logic can be translated into VBA):
Week beginning Sunday: if run on a Sunday will return the current date:
SELECT DATEADD('WW', DATEDIFF('WW', #1990-01-07 00:00:00#, NOW()), #1990-01-07 00:00:00#)
Week beginning Sunday: if run on a Sunday will return the previous Sunday:
SELECT DATEADD('D', (DATEDIFF('D', #1990-01-08 00:00:00#, NOW()) \ 7) * 7, #1990-01-07 00:00:00#)
Hint: 1990-01-07 00:00:00
is an arbitrary date known to be a Sunday.