Results 1 to 7 of 7
  1. #1
    anchamal is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Dec 2010
    Posts
    15

    Transfer data from a subform


    I have a subform in a form which always displays three records.
    what i need to do is when a click on a button to transfer these data to three fields in my form.


    subform name: subform1
    main form : itemsales
    fields to update on main form: text1,text2,text3


    (text1 should get first record in the subform, text2 should get the second and text3 should get the third one).


    what vba code should i use to do that?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    use the picker to get the correct path to the fieldnames....

    me.text1 = me.subform1.form.field1
    me.text2 = me.subform1.form.field2

  3. #3
    anchamal is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Dec 2010
    Posts
    15
    ranman thank for your reply

    this code transfers only the first record of the subform, what about the second and third?

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    it ONLY transfers data the cursor is on.
    IF you want it to xfer ALL records, then run a query, but theres no point of tranfering N sub records to a single record in the master form.

  5. #5
    anchamal is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Dec 2010
    Posts
    15
    what about some kind of a loop that will get focus on each field and transfer ?

  6. #6
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    That's a waste of time and code and effort.
    access is a database. It uses SQL queries to alter Bulk records. No need to code loops. Queries do this.

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @anchamal

    Why do you want to duplicate data in your database?

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

Similar Threads

  1. Replies: 4
    Last Post: 02-19-2014, 03:32 PM
  2. Replies: 3
    Last Post: 06-19-2013, 02:39 PM
  3. Transfer ID from Form to Query Subform field
    By smcfadden777 in forum Forms
    Replies: 4
    Last Post: 03-11-2012, 08:06 PM
  4. Transfer Data from Old DB to New
    By 1eye1vision in forum Import/Export Data
    Replies: 7
    Last Post: 08-06-2011, 02:12 PM
  5. Data Transfer
    By access_man in forum Access
    Replies: 0
    Last Post: 10-27-2010, 04:47 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