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
| FAQ | Members List | 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 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
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2004, 10:14 AM
Authorized User
Join Date: Apr 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Duplicate invoice

Hi everyone,
I am new to VBA.
Sometimes a client asks for the same list of products that before so I would like to replicate an invoice (including the items) for the same client, where the order date is the only thing that changes.
Could anyone let me know how to do it using the Northwind example?
The tables used are orders, order details and Customer.
Thanks a lot.

Reply With Quote
  #2 (permalink)  
Old April 4th, 2004, 05:19 PM
Friend of Wrox
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts

A couple of options - and no, I won't be using the Northwind example - I'll use an even more general example.

If Record Selectors are displayed, you could just copy and paste a record, then change the Order Number (or whatever you've called it)
If you need to do something a little more tricky, you could use the Clipboard in a more imaginative way.

Say for example, you have some hidden fields, or there's only certain fields you want copied:
Create a delimited string based on the fields you want to copy,
send it to the clipboard
Go to your new record
Retrieve it from the clipboard
Strip out your delimiters
Put them into the new values

To strip the delimiters out,
might be helpful



I am a loud man with a very large hat. This means I am in charge
Reply With Quote
  #3 (permalink)  
Old April 6th, 2004, 03:24 AM
Authorized User
Join Date: Apr 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for yor help, however what I would like to add a buttom that says "Add Duplicate". It means I have to duplicate:
- the order record/row (having today date)
- the order details records/rows

I am running into problems when I have to duplicate several order details rows. I have no idea how to duplicate them. Nortwind provides the same Orders layout that I have for my invoices.]
I am using Access 97.


Reply With Quote
  #4 (permalink)  
Old April 6th, 2004, 08:20 PM
sal sal is offline
Friend of Wrox
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts

You could also create an append query and base it off of the primary key of a "selector" form where a user would look up an invoice to duplicate. Set the default value for the field in the table to todays date:


That will ensure that your date will be set as today's date.
if you are trying to duplicate a complete set of rowa, or maybe line items on an invoice, then use the complete set for the append query.

This are some ideas, hope they work (since I do not know your table structure)

Reply With Quote
  #5 (permalink)  
Old April 7th, 2004, 04:43 AM
Authorized User
Join Date: Apr 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for you help, however I do not grasp the idea.

Using the Nortwind example, I would like to add a butoom that allows me copy an order and order details at the end.
On this example the first order contain 3 products, so I would like to add new order with today order date and the 3 products by pressing a button that says "duplicate order".

I can use the clipboard to copy the order fiels however I do not know to replicate the 3 products under the new order.
Again I am new to VBA and I do not find an easy way of doing it.

My question is:
What VBA code I need in the "duplicate order" button?
I would like to use the Northwind because it is very similar to our database.

Thanks a lot.

Reply With Quote

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
Creating an invoice dgprotective Access VBA 5 November 2nd, 2007 06:48 AM
Generating an invoice. dgprotective VB How-To 10 October 30th, 2007 09:07 AM
Invoice excel vb6 Project help alireza Excel VBA 1 November 18th, 2006 12:56 PM
Invoice Set & Get Method wldctj8 Java Basics 2 October 13th, 2006 09:50 PM
Create an Invoice with Data Report without using D ubaidmt VB Databases Basics 0 April 20th, 2004 10:09 AM

All times are GMT -4. The time now is 06:43 AM.

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