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

Copy, Paste and Append

P: 1
I have a Microsoft Access 2010 database, which has all of the my clients information and transports. I want to create a button called return trip on my main form which does the following.

What I want the button to do is to look at the main form which has all of the transport information, with the subform having all of the clients information and then create a new record based on the current one and keep the same client attached to the new record while at the same time on the new record for the main form filling in the pickup and drop off locations for the transport based on the original record. So it would take all of the pickup information swap it for the drop off information, and the drop off information would now be the pickup information, below are the fields that I have for both pickup and drop off.

Pickup Name
Pickup Address
Pickup City
Pickup County
Pickup State
Pickup Zip Code
Pickup Phone Number

Thank you for any and all the help you can provide on this. Its been driving me nuts for over a month now. I have to admit that obviously I am still learning a lot when it come to microsoft access so any help you can provide will be immensely appreciated. By the way I am using Microsoft Access 2010 Pro if that helps. I know that there were many changes between the 2000 version to now.

THANKS AGAIN!
Dec 4 '11 #1
Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,680
Swaps are typically performed via the use of an Intermediate Variable (strTemp in this case), such as in:
Expand|Select|Wrap|Line Numbers
  1. Dim strValue1 As String
  2. Dim strValue2 As String
  3. Dim strTemp As String
  4.  
  5. strValue1 = "Philadelphia"
  6. strValue2 = "New York City"
  7.  
  8. Debug.Print "Before Swap:"
  9. Debug.Print "|-- strvalue1: " & strValue1
  10. Debug.Print "|-- strvalue2: " & strValue2
  11.  
  12. '*** Start the Swap Process here: ***
  13. strTemp = strValue2
  14. strValue2 = strValue1
  15. strValue1 = strTemp
  16. '************************************
  17.  
  18. Debug.Print
  19.  
  20. Debug.Print "After Swap:"
  21. Debug.Print "|-- strvalue1: " & strValue1
  22. Debug.Print "|-- strvalue2: " & strValue2
  23.  
Expand|Select|Wrap|Line Numbers
  1. OUTPUT:
  2. Before Swap:
  3. |-- strvalue1: Philadelphia
  4. |-- strvalue2: New York City
  5.  
  6. After Swap:
  7. |-- strvalue1: New York City
  8. |-- strvalue2: Philadelphia
  9.  
Dec 4 '11 #2

NeoPa
Expert Mod 15k+
P: 31,712
I would recommend that you reconsider your design. A design such as you describe for storing this information is clumsy to say the least. The data should be stored once only and not twice. Database Normalisation and Table structures may help you understand some of the issues involved with database design.
Dec 4 '11 #3

Post your reply

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