Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 2nd, 2015, 06:18 PM
Registered User
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


Is there an easy way to do this?

Sorry if the explanation isn't great.

Old December 3rd, 2015, 04:12 PM
Authorized User
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts

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:

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.


Old December 3rd, 2015, 07:48 PM
Registered User
Join Date: Nov 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

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

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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.