Solved

Dates in VB

Posted on 1997-12-10
2
325 Views
Last Modified: 2008-02-01
My clients will enter the date of first payment.
I need to add month, week, bi-monthly, semi-monthly to this date and show on the screen. Can vb do it automaticaly or can someone help me with the code.
0
Comment
Question by:anna120297
2 Comments
 

Accepted Solution

by:
TaoistBear earned 20 total points
ID: 1444632
Use the DateAdd function.  Intervals must be Long integers, so fractional intervals will not work properly.

Dim MyDate As Date
Dim NextWeek As Date
Dim NextMonth As Date
Dim NextBiMonthly As Date
Dim NextSemiMonthlyA As Date
Dim NextSemiMonthlyB As Date

MyDate = CDate(Text1)
NextWeek = DateAdd("w", 1, MyDate)
NextMonth = DateAdd("m", 1, MyDate)
NextBiMonthly = DateAdd("m", 2, MyDate)
NextSemiMonthlyA = DateAdd("d", 15, MyDate)
NextSemiMonthlyB = DateAdd("m", 1, MyDate)

0
 
LVL 8

Expert Comment

by:mrmick
ID: 1444633
Nice job poo!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now