Results 1 to 8 of 8
  1. #1
    darwin is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    28

    how to transfer data from one field to another field

    I have a form

    In the form I have two fields, a bonus field and a confirm field

    What I want is; when type a number in the bonus field (textbox)


    then the number must automatically appear in the confirm field (textbox)

    In the formular event I am unsure which event I should choose, and in the
    vba I am unsure what to type.

    In the event of bonus field I have tried this in a afterupdate event, but no reaction
    appear.

    Private Sub Bonus_AfterUpdate()
    Me.Bonus = Me.Confirm
    End Sub

    hope some can help me, i am quite new access and vba user

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Why are you duplicating data? What purpose does this serve?

    Textbox can have expression that refers to another textbox: =[textbox1]

    You have the code backwards.

    Me.Confirm = Me.Bonus
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Yes AFTERUPDATE is correct.
    tho the user may need to press enter.
    oh, yeah, the assignment is backwards.

  4. #4
    darwin is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    28
    But the afterupdate event where to place it
    the bonus field (textbox) or the confirm field (textbox)

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The event shown is correct. The assignment expression was wrong.

    You describe a requirement to set value of Confirm after data input to Bonus. Then logically the code must be associated with the Bonus textbox.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    darwin is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    28
    Thanks June7

    But there is no reaction

    I have a issue here

    The form is bouild on a Query

    the bonus field is a calculated field with no table,

    the field look as this "Bonus: (([tblStamData]![Løn]*[tblBonus]![Overtid50Antal.........."

    the confirm field has a table

    I have tried a test with a table with two normal fields, and here it is okay, so it look like issue with
    a calculated field ??

  7. #7
    darwin is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    28
    Yes I fix it, I place the Me.Confirm = Me.Bonus, to another field

    Sorry

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Okay, then why are you saving calculated data? Why not just calculate when needed?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-27-2013, 02:33 PM
  2. Replies: 3
    Last Post: 06-19-2013, 02:39 PM
  3. Data Transfer from one field to another
    By Sahara May in forum Access
    Replies: 1
    Last Post: 08-01-2012, 12:30 AM
  4. Transfer ID from Form to Query Subform field
    By smcfadden777 in forum Forms
    Replies: 4
    Last Post: 03-11-2012, 08:06 PM
  5. Transfer date to another field
    By groovychick in forum Access
    Replies: 4
    Last Post: 12-20-2011, 06:13 AM

Tags for this Thread

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