Using DatePart "w" returns the day of the week as a value from 1-7 Sunday, Monday thru Saturday. In your logic, you do not establish what today is. The first thing you need to say is
MyToday = DatePart("w",MyDate)
Then establish what yesterday is
Select Case MyToday
Case 1,2,7 'Sunday...