Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Reports based on date and day of week

Status
Not open for further replies.
Jun 26, 2001
41
US
Hey all,

I am sure this is easy for most

but I am stuck

I want to create a cmd button on a form that prints a certain report based on the date and if it is a Monday

this is what I have for code

If Date = (mm / 1 / yyyy) Then
DoCmd.OpenReport "1stoftheMonthReport(andNotaMonday)"
Else
DoCmd.OpenReport "ItemstoCheckReport(1stoftheMonthandaMonday)"
Rem DoCmd.OpenReport "DailyReport(NotaMondayandNotthe1stoftheMonth)"
End If
End Sub

Not sure what I should put in the date line for the system to auto populate the month and year part of the date.

Any suggestions would be great

thx,

Byron
 
I am not sure what you want but try something like:
Code:
If Day(Date) = 1 AND WeekDay(Date)= 1 Then
    DoCmd.OpenReport "1stoftheMonthReport(andNotaMonday)"
 Else
    DoCmd.OpenReport "ItemstoCheckReport(1stoftheMonthandaMonday)"
End If

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top