By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,640 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,640 IT Pros & Developers. It's quick & easy.

Need to repeat records

tlove1966
P: 3
Hello everyone...I have a table that looks like this:

CustNo / BullCode / Doses
123456 / 123HO3214 / 3
321654 / 654JE1245 / 5
456789 / 478AY6549 / 10

and so on.

What I am trying to do is for each record that shows more than one dose as above, I need to repeat that line to match the number of doses

For example the first line I show you here needs to look like this when I'm done:

CustNo / BullCode / Doses
123456 / 123HO3214 / 3
123456 / 123HO3214 / 3
123456 / 123HO3214 / 3

Quite honestly at this point, I no longer care about the number of doses, I just need it to list it 3 times....

I'm certain there must be a way...Any assistance is greatly appreciated.

TL
Oct 15 '07 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,366
You'll need to do some VBA coding, where do you stand on that?
Oct 15 '07 #2

tlove1966
P: 3
I stand in the dark... :-)
Oct 16 '07 #3

Rabbit
Expert Mod 10K+
P: 12,366
Well, first you'll want to find a VBA tutorial and start learning the basics. After that, what you'll want to do is:

1) Open up a recordset that uses SELECT DISTINCT so you don't get duplicate records.

2) Use a Do Until recordset.EOF to loop through all the records.

3) Use a For i = 1 to recordset!Doses to loop the next command x times where x = number of Doses.

4) Use a DoCmd.RunSQL "Insert ..." to insert a copy of the record.

5) Increment the recordset.

So, read up on VBA, test out some stuff, and once you get started, we can help you through any implementation issues you have.
Oct 16 '07 #4

tlove1966
P: 3
Great...thank you...I'll see what I can come up with....
Oct 16 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.