|
-
Sep 27th, 2000, 04:10 PM
#1
Thread Starter
New Member
I'm working on a program that generates trigger dates from a date of hire using the DateAdd function. I can do it in an Access form but I need to use Visual Basic, which I'm not very familar with. Can anyone help?
-
Sep 27th, 2000, 04:44 PM
#2
Fanatic Member
MSDN :
DateAdd(interval, number, date)
The interval argument has these settings:
Setting Description
yyyy = Year
q = Quarter
m = Month
y = Day of year
d = Day
w = Weekday
ww = Week
h = Hour
n = Minute
s = Second
Iain, thats with an i by the way!
-
Sep 27th, 2000, 04:50 PM
#3
Thread Starter
New Member
Great, but how would put that in a subroutine?
-
Sep 27th, 2000, 04:59 PM
#4
Fanatic Member
Code:
Dim dt1 As Date, dt2 As Date
Dim dtNew As Date
Dim lDif As Long
'set two date objects
dt1 = "04/08/1979"
dt2 = Now
'find the number of months difference between the dates
lDif = DateDiff("m", dt1, dt2)
'add the difference to dt2, to create a new date
dtNew = DateAdd("m", lDif, dt2)
Iain, thats with an i by the way!
-
Sep 28th, 2000, 08:29 AM
#5
Thread Starter
New Member
That helps, but I'm still having trouble getting the hire date from the database. Could someone show me an example?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|