473,661 Members | 2,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to test whether date is today

lee123
556 Contributor
how do i change this code to do dates instead if time:

Expand|Select|Wrap|Line Numbers
  1.   CurrentTime = Format(Time, "hh:mm")
  2.     If CurrentTime = txtBillTime.Text Then
  3.         Beep
  4.         frmAppointment.WindowState = 0 'Restore form
  5.     End If
lee123
Dec 26 '07 #1
19 2120
VijaySofist
107 New Member
Hi!

I think this is the one you looked for

Code: ( text )

1. CurrentDate = Format(Date, "dd-MM-yyyy")
2. If CurrentDate = Format(txtBillD ate.Text,"dd-MM-yyyy") Then
3. Beep
4. frmAppointment. WindowState = 0 'Restore form
5. End If


If the above is not the code you looked for means, Can you please explain clearly.


All the Best

With Regards
Vijay. R
Dec 26 '07 #2
debasisdas
8,127 Recognized Expert Expert
If you want date why passing time ?

Instead of passing time ,you need to pass date.
Dec 26 '07 #3
lee123
556 Contributor
Debasisdas,
i stumbled on to this code for a project im doing. and the way they did this it only had time. but i wanted something with dates. so when that date hit it would pop up the form (a reminder)

thanks vijaysofist i'll try this and see if it works.

lee123
Dec 26 '07 #4
lee123
556 Contributor
hey vijaysofist,

i found this code in a book i have because it deals with something i've been trying to do but it only has the time i wanted it for the date. so i can set it and when the date hit it would pop up the message i typed in the form like a reminder the whole code to this is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSetTime_Click()    
  2.     frmAppointment.WindowState = 1  ('this is to set the form to close to the task bar)
  3.     Timer1.Enabled = True  
  4. End Sub
then in the timer i have this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Timer1_Timer()
  2.     On Error Resume Next
  3.    CurrentDate = Format(Date, "mm-dd-yy")
  4.     If CurrentDate = Format(Txtbilldate, "mm-dd-yy") Then
  5.         Beep
  6.         frmAppointment.WindowState = 0 'Restore form
  7.     End If
  8. End Sub
I wanted this code to do dates so i can enter in a date so when the date came it would remind me of a task or appointment. but i tried your code and the form doesn't close to the taskbar it keeps popping back up when i try to set the date


lee123
Dec 26 '07 #5
lee123
556 Contributor
i have posted a reply but it never shows up
Dec 26 '07 #6
lee123
556 Contributor
hi there i have been posting posts but they don't show up anyway

to vijaysofist,

i have tried your code but it doesn't work the whole code i have in my form is this. in the button to (set the date):
Expand|Select|Wrap|Line Numbers
  1. Private Sub SetDate_Click()
  2.     On Error Resume Next
  3.     frmAppointment.WindowState = 1
  4.     Timer1.Enabled = True  'Start timer
  5. End Sub
and for the timer i have this now.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Timer1_Timer()
  2.     On Error Resume Next
  3.    CurrentDate = Format(Date, "mm/dd/yy")
  4.     If CurrentDate = Format(Txtbilldate, "MM/DD/YY") Then
  5.         Beep
  6.         Timer1.Enabled = False
  7.         frmAppointment.WindowState = 0 'Restore form
  8.     End If
  9. End Sub
  10.  
but the whole thing is suppose to be a (reminder form) that pops up when you set the date you want to be reminded of a task or appointment. but i can't get it to work right.

to debasisdas:

to answer your question i found this code in a book i have but it deals with the time only and it's similar to what i wanted to do but with dates i wanted to use this code for the project above. by the way what did you mean by this:


Expand|Select|Wrap|Line Numbers
  1. If you want date why passing time ?
  2.  
  3. Instead of passing time ,you need to pass date.
lee123
Dec 27 '07 #7
VijaySofist
107 New Member
hey vijaysofist,

i found this code in a book i have because it deals with something i've been trying to do but it only has the time i wanted it for the date. so i can set it and when the date hit it would pop up the message i typed in the form like a reminder the whole code to this is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSetTime_Click()    
  2.     frmAppointment.WindowState = 1  ('this is to set the form to close to the task bar)
  3.     Timer1.Enabled = True  
  4. End Sub
then in the timer i have this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Timer1_Timer()
  2.     On Error Resume Next
  3.    CurrentDate = Format(Date, "mm-dd-yy")
  4.     If CurrentDate = Format(Txtbilldate, "mm-dd-yy") Then
  5.         Beep
  6.         frmAppointment.WindowState = 0 'Restore form
  7.     End If
  8. End Sub
I wanted this code to do dates so i can enter in a date so when the date came it would remind me of a task or appointment. but i tried your code and the form doesn't close to the taskbar it keeps popping back up when i try to set the date


lee123


Hi!

So you want your form to close to the taskbar! Right.

Please Look back your code. This is because in the cmdSetTime_Clic k() Event - you minimized the Form and then Enabled the Timer - where the timer maximizes the form again.

Use
---------------
frmAppointment. WindowState = 0 'in the cmdSetTime_Clic k() Event

and Use
--------------
frmAppointment. WindowState = 1 'in the Timer1_Timer() Event

Please get back to me, whether it works for you or not.


All the Best

With Regards
Vijay. R
Dec 27 '07 #8
VijaySofist
107 New Member
Hi!

Check whether if you are using a text box named Txtbilldate to get the date.

Check it and reply My Friend!


With Regards
Vijay. R
Dec 27 '07 #9
9815402440
180 New Member
hi
replace line
If CurrentDate = Format(Txtbilld ate, "MM/DD/YY") Then
with following line

If datediff("d",fo rmat(CurrentDat e,"mm/dd/yy") , Format(Txtbilld ate, "MM/DD/YY"))=0 Then

because using CurrentDate = Format(Txtbilld ate, "MM/DD/YY") you are comparing two strings not two dates.

regards
manpreet singh dhillon hoshiarpur
Dec 27 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3206
by: Eric Linders | last post by:
Hello, Today is Thursday, August 18, 2004. I would like to have a variable that stores the date this coming Sunday (even if today happened to be Sunday) in YYY-MM-DD format. I also need a variable that will store the date this past Monday (even if today happens to be Monday) also in YYY-MM-DD format. So, the end result is that, for this week (today is 2004-08-18) I would have the following two variables:
2
4158
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or why it doesn't work? Thanks in advance Tjerk
38
7129
by: | last post by:
I have a script... ----- <SCRIPT language="JavaScript" type="text/javascript"> <!-- function makeArray() { for (i = 0; i<makeArray.arguments.length; i++) this = makeArray.arguments; } function makeArray0() {
176
8334
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write their own unit test framework, and then in a lab session see if I can get them to write their own. To give them an example I've created the following UTF class (with a simple test program following). I would welcome and suggestions on how anybody...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.