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?

write your code

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

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

1.jpg1.jpg

This post has no text-based content.

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))

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.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.