Results 1 to 4 of 4
  1. #1
    sublevelmonkey is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Posts
    10

    [Access 2003/2010] Copying data from multiple form text boxes

    Hi,

    First post, so hope it's in the right place and done appropriately!

    Working with an Access Form (in 2010 but would like to be backwards compatible to 2003), I'm trying to create a button that, if clicked, would copy all the information entered in a set of text boxes, into another set of text boxes on the same form.

    In more detail: I have a form to collect information about 2 types of people associated with a common object, (i.e. Collectors and Donors). Sometimes this is the same person, but I still need to record this persons information as both Collector and Donor.

    I've been trying to find a way to code a button that would, where necessary, allow a simple click to copy all the information in the Collector fields to the Donor fields but I'm completely new to any sort of programming!

    I can make it work using a clumsy code (below, created in 2010), but this doesn't work where there are blank fields (which are unavoidable) and it doesn't seem to work at all in Access 2003 (In fact Access 2003 really doesn't like it and falls over when I try to edit the VB code for this).

    Code:
    Private Sub CollectorIsDonor_Click()

    Me.CollectorTitle.SetFocus
    Me.CollectorTitle.SelStart = 0


    Me.CollectorTitle.SelLength = Len(Me.CollectorTitle.Value)
    DoCmd.RunCommand acCmdCopy
    DoCmd.GoToControl "DonorTitle"
    Me.DonorTitle.SetFocus
    DoCmd.RunCommand acCmdPaste

    (Repeated for each applicable field in the form)

    End Sub


    I've definitely bitten off more than I can chew, but how else will I learn?

    Thanks for any help offered.
    Last edited by sublevelmonkey; 01-17-2012 at 10:51 AM. Reason: solved

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Does this single line work (you don't need all of that)?

    Me.DonorTitle = Me.CollectorTitle
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    sublevelmonkey is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jan 2012
    Posts
    10
    It does!

    I had a nagging feeling things were moving towards the wildly over-engineered!

    Note to self: Next time, ask the internet sooner. It's all-knowing.

    Baby steps

    Thanks pbaldy.

    (Think I looked at your website at some point during this process, so thanks for that as well )

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Move all access 2003 data to sharepoint 2010
    By accesstosharepoint in forum SharePoint
    Replies: 0
    Last Post: 10-22-2011, 08:32 AM
  2. Replies: 9
    Last Post: 08-07-2011, 11:21 AM
  3. Replies: 4
    Last Post: 02-14-2011, 09:11 AM
  4. Replies: 13
    Last Post: 11-20-2010, 06:45 AM
  5. Copying only part of data from a text field
    By davedejonge in forum Queries
    Replies: 1
    Last Post: 02-03-2010, 05:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums