Hello
I am using Access 2k and what I'm trying to do is create an expression that will change a Date label on a report. It is a two column report and each column is for a different day, generally consecutive days. But, if the current day is Friday it will ask the user if they are working the next day, Saturday. If so then the 2nd column will have the Saturday as the label. No problems there with this code...
It is the expression for the label on the report. I just want the day of the week to show.
But, if they are not working Saturday then the 2nd column label needs to display Monday instead. I tried this bit...
But I am getting the error "Type mismatch."
I have this code within a button on a form calling the report. I wonder if there is a better location for it since earlier I was getting the error "The report name 'rptRotationTwoDay' you entered is misspelled or refers to a report that isn't open or doesn't exist."
thanks for any help!
Duane
I am using Access 2k and what I'm trying to do is create an expression that will change a Date label on a report. It is a two column report and each column is for a different day, generally consecutive days. But, if the current day is Friday it will ask the user if they are working the next day, Saturday. If so then the 2nd column will have the Saturday as the label. No problems there with this code...
Code:
=Format(DateAdd("d",1,Date()),"dddd")
But, if they are not working Saturday then the 2nd column label needs to display Monday instead. I tried this bit...
Code:
Private Sub cmdReportTwoDay_Click()
on Error GoTo Err_cmdReportTwoDay_Click
Dim stLinkCriteria as String
Dim myDate As Date
Dim response as String
myDate = Weekday(Date)
If myDate = 6 Then
MsgBox "It's Friday! Are you working tomorrow?", vbYesNo
If response = vbNo Then
Reports!rptRotationTowDay.Controls!txtDate2 = Format(DateAdd("d",3,Date()),"dddd")
End If
stDocName = "rptRotationTwoDay"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdReportTwoDay_Click:
MsgBox Err.Description
Resume Exit_cmdReportTwoDay_Click
End Sub
I have this code within a button on a form calling the report. I wonder if there is a better location for it since earlier I was getting the error "The report name 'rptRotationTwoDay' you entered is misspelled or refers to a report that isn't open or doesn't exist."
thanks for any help!
Duane