Enter an automatic date into an export

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro set up to export to an Excel spreadsheet, but I was wondering
if there is anything I can add to make it automatically enter a week ending
date?

I don't care if I have to use code or an input box or anything, just so long
as it works. Is this possible??
 
If your macro runs off a query you can simply add an extra field in the
query which works out the [WEdate] using IIF(),DateAdd() and Weekday()
functions.

If you need assistance with the syntax let me know..

John
 
If you wouldn't mind, could you help with the syntax? Cheers.

John Ortt said:
If your macro runs off a query you can simply add an extra field in the
query which works out the [WEdate] using IIF(),DateAdd() and Weekday()
functions.

If you need assistance with the syntax let me know..

John

cdb said:
I have a macro set up to export to an Excel spreadsheet, but I was wondering
if there is anything I can add to make it automatically enter a week ending
date?

I don't care if I have to use code or an input box or anything, just so long
as it works. Is this possible??
 
Give the following a try -

LastDayInWeek:
IIf(Weekday([YourDate],2)<>7,DateAdd("d",7-Weekday([YourDate],2),[YourDate])
,[YourDate])

Where the 2 in the Weekday expressions mean a week starting on Monday (1
would be Sunday, 3 Tuesday etc)

I am sure some of the other Newsgroup lurkers can think of a cleaner way of
doing it but that should work fine...

Hope it helps,

John
 
Back
Top