Date Format

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

Guest

I am using Acc97. I have this if statement of 2 separate forms
If Format(txtDate, "dddd") = "Friday" Then
'displays the number of work hours for friday
else
' displays the default number of work hours
end if

This statement works on form1 but not on form2. On form2 when I change = to
<> it displays the hours for the days that are not Fridays. So I know it is
reading the statement.

Any suggestions as to why it is not working?

Thanks
 
It is working correctly, you are just telling it something other than what
you want.

On form 1 you want to display default work hours for every day other than
Friday.
On form 2 you are asking it to display Friday work hours for every day
except Friday.
What is it you really want?
 
Put a break point in the code then step through the code. What value is it
showing for txtDate? Hold the mouse over txtDate when you get to that line
and see what value pops up in the tooltip of add a Debug.Print txtDate
statement to send the value to the Immediate Window. Also, if all you want
is to compare it to a day of the week, you may want to try the Weekday()
function.

If Weekday(Me.txtDate) = 6 Then
or
If Weekday(Me.txtDate) = vbFriday Then
 
Back
Top