?
Solved

change if statement to include time between two values

Posted on 2012-03-11
2
Medium Priority
?
316 Views
Last Modified: 2012-03-12
Hello,
will paste part of code here:
is there a way to change to a between statement - between 1 and 4:30?

Dim one As Date
Dim strMessage As String
Dim strControlIn As String
Dim strControlOut As String
Dim strButton As String
Dim strText As String
Dim strLIn As String
Dim strLOut As String

    one = Now
   
    strControlIn = "txtFriIn"
    strControlOut = "txtFriOut"
    strButton = "cmdFriOut"
    strText = "txtReg5"
    strLIn = "txtFriLin"
    strLOut = "txtFriLout"
   
    If TimeValue(one) >= #1:00:01 PM# And Weekday(one) = vbFriday Then
        strMessage = "Leaving at " & one & " Logged as 4.30pm"
    Else
        strMessage = "Leaving at " & one
    End If
   
Right now the code clocks anybody who clocks out after 1:00 on friday- at 4:30
I need to change it to say clock anybody who clocks out after 1:00 and not later than 4:30-at 4:30---------( but if they clock out later than 4:30- then it should go back to clocking out real time-now()
thank you
0
Comment
Question by:davetough
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 37708153
Try this:

If TimeValue(one) >= #1:00:01 PM#  And TimeValue(one) <= #4:30:00 PM# And Weekday(one) = vbFriday Then

'etc.
0
 

Author Closing Comment

by:davetough
ID: 37709088
thank you
0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question