Solved

VB.net code to check time

Posted on 2014-04-10
6
753 Views
Last Modified: 2014-05-12
Hi all I am trying to write a script in vb.net needs to send an email but only between a certain time frame. Something to effect of
if x is = y and y is = w and time is between 5pm and 11pm then send the email. Everything works so far, I just need the piece for the time range.
0
Comment
Question by:xzay1967
[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
6 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39991701
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39991749
...or:

... (Now.Hour >= 17 AndAlso Now.Hour <= 23) Then

Open in new window

0
 

Author Comment

by:xzay1967
ID: 39992016
hmm,@kaufmed, so if I used your suggestion, would I apply it as:
if x=y and y=w and if (Now.Hour >= 17 AndAlso Now.Hour <= 23) Then "send email"? Do I need to declare anything first?
@CodeCruiser not ignoring your suggestion, just gonna try the simpler option.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39992042
Logically speaking, yes. In specific code, though, you've got a syntax issue.

i.e.

If x = y AndAlso y = w AndAlso Now.Hour >= 17 AndAlso Now.Hour <= 23 Then
    "send email"
End If

Open in new window


You had an extra "If" in yours.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40058458
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

737 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