Pls check code

  • Thread starter Thread starter RobUCSD via AccessMonster.com
  • Start date Start date
R

RobUCSD via AccessMonster.com

With the code below the cmdVisitEdit is always invisible. this is in the on
current event. It shouldn't be always invisible if the tests work. If the out
of room time is over 30 minutes or if visit date is not today, then the
cmdVisitedit should be visible. Anybody have any ideas as to why it's not
working?

Thanks, Rob



If DateDiff("n", Me.OutOfRoom, Now) >= 30 Or Me.VisitDate <> Date Then

Me.cmdVisitEdit.Visible = False
Else
Me.cmdVisitEdit.Visible = True
 
The line "If the out of room time is over 30 minutes or if visit date is not
today, then the cmdVisitedit should be visible" should read "....the
cmdVisitEdit should be inVisible" Sorry for the confusion.
 
RobUCSD said:
With the code below the cmdVisitEdit is always invisible. this is in the on
current event. It shouldn't be always invisible if the tests work. If the out
of room time is over 30 minutes or if visit date is not today, then the
cmdVisitedit should be visible. Anybody have any ideas as to why it's not
working?\

If DateDiff("n", Me.OutOfRoom, Now) >= 30 Or Me.VisitDate <> Date Then

Me.cmdVisitEdit.Visible = False
Else
Me.cmdVisitEdit.Visible = True


You probably only have a time value in the OutOfRoom text
box (which means it date part is 12/30/1899). If so, you
ahould use the Time function instead of Now.
 
Marshall, thanks for your response. Here's what I changed it to, but the
visit button is still not visible when the correct criteria are met. The
field OutOfRoom is a date/time field with a short time format. Any other
thoughts, thanks Rob

If DateDiff("n", Me.OutOfRoom, Time) >= 30 Or Me.VisitDate <> Date Then

Marshall said:
With the code below the cmdVisitEdit is always invisible. this is in the on
current event. It shouldn't be always invisible if the tests work. If the out
[quoted text clipped - 7 lines]
Else
Me.cmdVisitEdit.Visible = True

You probably only have a time value in the OutOfRoom text
box (which means it date part is 12/30/1899). If so, you
ahould use the Time function instead of Now.
 
Marshall, thanks. I got this working by changing Now to Time(). Thanks for
your help this sunday am. Hope you have a great day. Rob
Marshall, thanks for your response. Here's what I changed it to, but the
visit button is still not visible when the correct criteria are met. The
field OutOfRoom is a date/time field with a short time format. Any other
thoughts, thanks Rob

[quoted text clipped - 5 lines]
box (which means it date part is 12/30/1899). If so, you
ahould use the Time function instead of Now.
 
Back
Top