My Assistant
![]() ![]() |
|
|
Jan 26 2007, 11:54 AM
Post
#1
|
|
|
UtterAccess Ruler Posts: 1,507 From: Redondo Beach, CA |
Does anybody know of a way to generate a series of random dates in Access? I want to generate, through VBA a random date between today and two weeks ago.
Thanks. |
|
|
|
Jan 26 2007, 12:01 PM
Post
#2
|
|
|
UtterAccess Addict Posts: 264 From: Allen, Texas |
Public Function RandomDate() As Date
Dim rndNum As Integer rndNum = Int((14 * Rnd) + 1) RandomDate = Date - rndNum End Function |
|
|
|
Jan 26 2007, 12:01 PM
Post
#3
|
|
|
Head Wizard Posts: 14,857 From: South Carolina, USA |
Actually, this is relatively easy using the DateAdd() and Rnd() functions.
DateAdd("y", -(Rnd([SeedField])*14 + 1), Date()) |
|
|
|
Jan 26 2007, 12:08 PM
Post
#4
|
|
|
UtterAccess Ruler Posts: 1,507 From: Redondo Beach, CA |
FedcDAD and Jerry,
Thanks! This site is really getting to be my "Easy Button." |
|
|
|
Jan 26 2007, 12:20 PM
Post
#5
|
|
|
UtterAccess VIP Posts: 12,201 From: Tacoma, WA. |
Rich,
See Attached
Attached File(s)
|
|
|
|
Jan 26 2007, 12:51 PM
Post
#6
|
|
|
Head Wizard Posts: 14,857 From: South Carolina, USA |
You're welcome.
Good Luck! |
|
|
|
Jan 26 2007, 01:15 PM
Post
#7
|
|
|
UtterAccess VIP Posts: 6,898 From: Earth... |
John,
I added your attachment to my 'MustSave' USB Drive. (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif) Aqua |
|
|
|
Jan 26 2007, 01:18 PM
Post
#8
|
|
|
UtterAccess VIP Posts: 12,201 From: Tacoma, WA. |
Good Deal Aqua, Glad to help out problem I have in doing that is
1. Remembering I have it 2. Remembering the name 3. Remembering where I placed it (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif) |
|
|
|
Jan 27 2007, 12:51 PM
Post
#9
|
|
|
UtterAccess Guru Posts: 518 From: Rivendell, Middle Earth |
John,
QUOTE I added your attachment to my 'MustSave' USB Drive. ....me too! Thanks!!! |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 22nd May 2013 - 12:41 PM |