Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy/Paste Functionality 1

Status
Not open for further replies.

cstuart79

Technical User
Nov 2, 2009
171
US
This seems like it should be simple enough but I have been unsuccessful in locating an answer. I want to be able to copy all fields in a subform with the click of one button. Then I will be pasting this info into an email or Word document. So basically, I want to perform a function similar to a "Select All" and "Copy". If you can suggest VBA code to paste into "On Click" event of button that would help a ton.


could be entire table (multiple fields, unlimited records) or just a few fields within 1 record depending on needs at the time.

ideally it could work just like copy/paste in a Word doc. however, my thought was to simplify it by having a "select all" button to highlight all fields and records in an entire subform or to have a "copy" button next to each particular record (highlighting all fields for that record)

 
when you say "all fields" are you talking about all the records too in other words everything returned in the subform? or are you wanting to just get all field for one record.
There is probably not an "easy" way but you could try this

this exmaple is just for one record in a subform, you have to highlight it by clicking the record selector on the left of the record in question then click your button which will have following code. This example assumes your fields are FName LName Address City State Zip and will put this down a list in the email.
code for sending an email:

Code:
    Dim EmailInfo As String
    Dim Email As String '< need to figure out where to get your emails from.
    
    EmailInfo = "FName " & Me.subformname!FName & vbCrLf
    EmailInfo = EmailInfo & "LName " & Me.subformname!LName & vbCrLf
    EmailInfo = EmailInfo & "Address " & Me.subformname!Address & vbCrLf
    EmailInfo = EmailInfo & "City " & Me.subformname!City & vbCrLf
    EmailInfo = EmailInfo & "State " & Me.subformname!State & vbCrLf
    EmailInfo = EmailInfo & "Zip " & Me.subformname!Zip
    
    DoCmd.SendObject acSendNoObject, "", acFormatTXT, Email, , , "Email Subject goes here", EmailInfo, False

If you are using Outlook you can attach Outlook folders such as Contacts as a table in Access. Right click on the Tables tab and pick "Link Tables then in the files of type at the bottom pick Exchange()
Next you should see familiar Outlook items, pick one and try it out.
You can have another sub form with all of emails in it and click one of them.
Then pick a record in your subform then click the email button and Bingo you off and running.
I just tried this in Access 2002 and Outlook 2002 so it does work.
And Access 2007 with Outlook 2002
The Trial version of Office 2007 I downloaded does not have Outlook 2007 not sure where it is now? Are they only giving it with Exchange Server?


DougP
[r2d2] < I Built one
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top