0

Good Day Everyone please I am writing a Check In and Check Out program to display the date increase in day/month/year whenever I input a number. Eg. suppose I type 2days on the Check In Form I want the Check Out Form to display the days difference from the current date i.e if the current date is 03/02/2016 (dd/mm/yyyy), it should automatically increase and display 05/02/2016 and likewise if I add a bigger number like 31 it should also increase automatically and display 03/03/2016.

Please I need help to go about it, can anyone please help me with the code and direction to go about it?

3
Contributors
7
Replies
20
Views
1 Year
Discussion Span
Last Post by Nawti
0

Firstly you must show your efforts where from we can help you to solve your problems.

To get your result you can use DateAdd(DateInterval, Double, DateTime) method

Edited by Shark_1

0

Private Sub Timer1_Timer()
Label3.Caption = Format$(Time, "hh:mm:ss AM/PM")
Label1.Caption = Date$
End Sub

0

The syntax is DateAdd(DateInterval, Number As Double, DateValue as Date)
For examp,
If you want to get next date which is 2 days after from your date value the syntax should be DateAdd("d", 2, CDate(Label1.Caption)).
When you are getting the dayspan from a textbox the syntax should be DateAdd("d", Val(Text1.Text), CDate(Label1.Caption))

So the complete code is

Label1.Caption = DateAdd("d", Val(Text1.Text), CDate(Label1.Caption))
0

1.jpg Thanks so much all for your assistance but I want to know where do i input the code as i am new into programming. Label1.Caption = DateAdd("d", Val(Text1.Text), CDate(Label1.Caption)) inside label, text or timer please help as it comes up with error.

Edited by Nawti

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.