Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 2nd, 2015, 06:18 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Split record to multi record in new table

Hello I wonder if anyone can help with a challenge I have? I'm looking to take a currency value and divide it by a number and the assign the split values to a date variable (1 month). EG: Single record data with unique ID sales value £500,000.00, number of deliveries 10 and first delivery date 3/6/2016 (there is also other information the the table record) and create a new table with 10 rows for this unique ID.

I.E. Row 1 = ID number, £50,000.00, 3/6/2016
Row 2 = ID Number, £50,000.00, 3/7/2016
Row 3 = ID Number, £50,000.00, 3/8/2016

Etc

Is there an easy way to do this?

Sorry if the explanation isn't great.

Regards
Reply With Quote
  #2 (permalink)  
Old December 3rd, 2015, 04:12 PM
Authorized User
Points: 346, Level: 6
Points: 346, Level: 6 Points: 346, Level: 6 Points: 346, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 13 Times in 13 Posts
Default

Hi William,

If you create a table that contains just numbers [Number] from 0 to maximum number then create an append query similar to the following:

Code:
INSERT INTO Deliveries ( SaleID, DeliveryDate, DeliveryValue, [<NoOfDeliveries] )
SELECT Sales.SaleID, DateAdd("m",[Number],[FirstDeliveryDate]) AS DeliveryDate, [SaleValue]/[NoOfDeliveries] AS DeliveryValue, Numbers.Number
FROM Sales, Numbers;
If NoOfDeliveries is not stored in the Sales table then you can still use this and be prompted.

The alternative is to use VBA to create the records using a For loop and DAO commands or just execute a built up string of SQL.

HTH.

Malc.
Reply With Quote
  #3 (permalink)  
Old December 3rd, 2015, 07:48 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Malc, I'll give it a try at the weekend, I think it might be a loop though so may be back for some more tips cheers W
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
check existence of a record in a database before inserting a new record ibmkahm ASP.NET 4 General Discussion 1 November 15th, 2010 03:44 AM
Find Last Record and Add new keyed record causualuser Access VBA 3 February 9th, 2009 08:24 AM
Getting just one record from Table knowledge76 Access VBA 8 May 23rd, 2005 07:55 AM
Record locking - user needs the next queued record cbtoolkit SQL Server 2000 0 December 6th, 2004 08:29 AM
can't display record from table. jenjenyan Access ASP 3 June 5th, 2004 12:36 AM



All times are GMT -4. The time now is 01:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.