VBA Express Forum  




Go Back   VBA Express Forum > VBA Code & Other Help > SQL
     Feedback     
Register FAQ Members Arcade Knowledge Base Training Articles Consulting

Reply
 
Thread Tools Display Modes
Old 04-03-2012, 09:07 AM   #1
stanl
 
stanl's Avatar

 
Joined: Jan 2005
Posts: 1,108
Kb Entries: 0
Articles: 0
creating random future dates with datediff()

Just need to set up a field with a series of random future dates based on an exisiting date - assume this is for an inventory (it isn't but the example is adequate)

Date_Entered Date_Sold

and you want to practice reports like 'what is the average days item_X is on the shelves.

So you generate 1,000 date_entered with a single date, and want to replace Date_Sold with a increment of between 1 and 45 days (Access Table)

I tried

Update mytable SET Date_Sold = Date_Entered + Int((45-1+1) * Rnd +1)

The issue seems to be that the same random number is used to update all rows.

Has anyone else experience this and know of a workaround?

Local Time: 11:33 AM
Local Date: 05-25-2013
Location:

 
Reply With Quote Top
Old 04-04-2012, 12:31 PM   #2
stanl
 
stanl's Avatar

 
Joined: Jan 2005
Posts: 1,108
Kb Entries: 0
Articles: 0
Nobody???

Local Time: 11:33 AM
Local Date: 05-25-2013
Location:

 
Reply With Quote Top
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 08:33 AM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2012 VBA Express