UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Any chance of getting random dates?    
 
   
WongMeister
post 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.
Go to the top of the page
 
+
fecdad
post 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
Go to the top of the page
 
+
Jerry Dennison
post 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())
Go to the top of the page
 
+
WongMeister
post 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."
Go to the top of the page
 
+
jmcwk
post Jan 26 2007, 12:20 PM
Post #5

UtterAccess VIP
Posts: 12,201
From: Tacoma, WA.



Rich,

See Attached
Attached File(s)
Attached File  DemoSelectRandomNumberOrPercentFromGroup2K.zip ( 18.44K ) Number of downloads: 13
 
Go to the top of the page
 
+
Jerry Dennison
post Jan 26 2007, 12:51 PM
Post #6

Head Wizard
Posts: 14,857
From: South Carolina, USA



You're welcome.

Good Luck!
Go to the top of the page
 
+
Aquadevel
post 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
Go to the top of the page
 
+
jmcwk
post 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)
Go to the top of the page
 
+
KristianDude
post 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 the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 12:41 PM