Results 1 to 15 of 15
  1. #1
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37

    Unbound text box real time updates


    I have a form setup that connects to a simple table that lets me edit it through datasheet view. Additionally, I have an unbound text box above my datasheet on the form which calculates a total value from the Tax field on a my table. My problem is I can't seem to get the unbound text box to update real time when I make changes to my table, the only way I can get it to update is by closing the form and reopening. Is there anyway to avoid having to do this, so the unbound text box calculates the total value real time?

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    In the after update event for the each field that you would edit enter
    Code:
    me.requery
    Alan

  3. #3
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    I'm not seeing that in the options in the property sheet for my table. Just to clarify, Within the form, I'm making actual changes to a table, and the unbound text box is calculating totals off that table.

  4. #4
    WAstarita is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Location
    consult-wa.com
    Posts
    5
    In the AfterUpdate event of the text box your boss is entering the new value

    Me.Requery

    Since afterupdate only fires after the control loses focus, if your boss is old school he would need a clear way to do that, you might want to add a calculate button and put Me.Requery in there too. This way if he tabs away from the text box or clicks the button its the same effect. If he wants to be able to type and hit enter to make the value calculate, set the Default property of the button to Yes

  5. #5
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Just to clarify, Within the form, I'm making actual changes to a table,
    Let me make sure I understand. You have a form. Within that form, you have a subform that is showing in datasheet format (looks like a table but is still a form.) In the design view of the subform, in the properties, you will find events.

    If this is not what is happening, then you will need to explain further. You should not be entering data directly into a table. You should be using a form (even if it looks like a table--datasheet view).

    Alan

  6. #6
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Sorry for the confusion, yes you are correct. This is a form with a subform showing the datasheet format.

    So I went into the form, and opened up the properties box and found the Afterupdate event. Entered in me.requery, but I still does not update. Does me.requery need to be entered differently? As VBA code?

    update: I entered it in as VBA code in the code builder and still no luck..

  7. #7
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Can you post a copy of your db? Make sure to sanitize it for confidential information and replace that with dummy data. Run a compact and repair to keep the size down before you upload. Make sure that there is sufficient data (not necessarily all) to run some tests.

    Alan

  8. #8
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Just pm'd you it
    Thanks

  9. #9
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Link pasted below with the database to download. I'm simplified it to just the form and table. The field I'm trying to get to sum real time is "Total Trade Amount" which is calculated off the [TradeAmt] field within the table.

    http://www.mediafire.com/?yahzu803gupnntd

  10. #10
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    I understand what you have now. You have put your table in the main form. I would urge you to remove the table. Create a form that is bound to the table. Arrange the field orders as you would like. In the properties for the form, set the default as datasheet view. It will look like your table but you can now manipulate data which you cannot do directly in a table. Insert this form as a subform in your main table making the appropriate parent child link. Now in the fields that you will be editing data in, put a me.requery or me.refresh in the afterupdate events for those fields in the subform.

    It is not a good idea to manipulate data directly in a table. You have less control over what you are doing.

    Alan

  11. #11
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Thanks, I made the corrections you pointed out. It now reads off a subform in datasheet view rather than the actual table. Does the me.requery need to be entered as VBA or can I just enter it right in the space for After update? Also, does me.requery need to be in the properties for my unbound text thats totaling the field?

  12. #12
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Ok, so after some reading, I'm assuming you mean to insert the me.requery code in VBA using the Code Builder. So with that being said, in the After Update event for the [TradeAmt] field that I want my Unbound text box to total off of (Unbound text box object name is Text15). I enter the following:

    Option Compare Database
    Private Sub TradeAmt_AfterUpdate()
    Me.Requery Text15
    End Sub


    However, now when I attempt to update the [TradeAmt] field in the sub form, I get the following error and the debugger pops up:

    Compile error:
    Wrong number of arguments or invalid property assignment

    Also, not sure if it matters, but these are the current references I have loaded:
    >Visual Basic for Applications
    >Microsoft Access 14 Object Library
    >Microsoft Excel 14 Object Library
    >Microsoft Data Access Components Installed Version
    >Microsoft ActiveX Data Objects 6.0 Library
    >Microsoft Office 14 Access database engine Object Library

  13. #13
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Try this:
    Code:
    Option Compare Database
    Private Sub TradeAmt_AfterUpdate()
    Me.Requery
    End Sub
    Remove the reference to Text15

  14. #14
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Still no luck, I removed all the other code and only put in the me.requery for the afterupdate of the TradeAmt field.

    updated db:
    http://www.mediafire.com/?b0bkr2awk3hfl7m

  15. #15
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Managed to figure out the solution. I just specified the entire form to Requery in the afterupdate.

    Private Sub TradeAmt_AfterUpdate()
    Forms("USER_frm_AssetTradeEditor").Requery
    End Sub

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

Similar Threads

  1. Real Time Incremental Back Up
    By GrnMtn7 in forum Access
    Replies: 1
    Last Post: 10-15-2011, 05:29 PM
  2. Blueprint for SQL data to excel in real time.
    By greggue in forum Programming
    Replies: 1
    Last Post: 12-21-2010, 12:39 PM
  3. real time clock
    By krai in forum Access
    Replies: 1
    Last Post: 05-13-2010, 05:11 AM
  4. Real time database question
    By joet5402 in forum Forms
    Replies: 7
    Last Post: 04-01-2009, 09:00 PM
  5. Update a combo box in real time
    By protean_being in forum Forms
    Replies: 0
    Last Post: 05-17-2008, 07:39 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