Results 1 to 6 of 6
  1. #1
    jgitaunjoroge is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Location
    Kenya
    Posts
    5

    Thumbs up Update of Textbox in Main form from Subform Textbox afterupdate

    Dear Members,



    How to i update unbound textbox in main form with a unbound textbox in subform afterupdate.
    For example i want to update Total amount paid, balance etc after txtamount textbox is updated.

    Thanks,
    Njoroge Joseph

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why would entry into subform UNBOUND textbox affect value in main form UNBOUND textbox?

    Why entering into UNBOUND 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.

  3. #3
    jgitaunjoroge is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Location
    Kenya
    Posts
    5

    Thumbs up

    Attached is the database. Am trying to work on customer form which contains a subform called Customertrans subform. When i update amount this is expected to reflect in the main form in amount paid, balance etcJOB SYSTEM.zip

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Balance should not be a field in table. This should be calculated when needed. What is Balance supposed to be - the sum of records in subform?

    Options for summing subform records:

    1. Use the Totals button from the ribbon to activate a Totals row on the Datasheet view subform

    2. Textbox in subform footer with expression to sum records: =Sum([Amount]). It won't show in Datasheet view but textbox on main form can reference it: =[Customertrans subform].[Form].[tbxTotal]


    Why are the main form controls UNBOUND?
    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.

  5. #5
    jgitaunjoroge is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Location
    Kenya
    Posts
    5

    update multiple columns in one statement.

    Hi Sirs,

    Kindly check for me where the error is in this code.
    HTML Code:
    DoCmd.RunSQL ("update customer set customer.paid=" &  Me.Parent.txtPAID.Value & ",customer.balance =" &  Me.Parent.txtCONTRACT.Value + Me.Parent.txtPAID.Value)

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Need WHERE clause that specifies which customer record to edit.

    I would use CurrentDb.Execute instead of DoCmd.RunSQL

    However, action SQL should not be necessary to save data into record already displayed on form.

    Again, saving aggregate data is usually a bad design.
    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: 2
    Last Post: 01-08-2014, 05:18 PM
  2. Replies: 2
    Last Post: 04-20-2013, 03:37 AM
  3. Replies: 2
    Last Post: 06-09-2012, 01:56 AM
  4. Replies: 7
    Last Post: 11-07-2011, 06:31 AM
  5. Replies: 3
    Last Post: 02-10-2010, 07:29 AM

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