Results 1 to 5 of 5
  1. #1
    Kevo is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Kodiak, Alaska
    Posts
    86

    Update changes on datasheet of splitform

    Hi,



    I have a split form in access 2007 with form above and datasheet below. On the form I have a few text boxes (qtyused,qtyreceived,etc...) and an "Update" button that has some calculations in the click on event.

    So, the user chooses the record in the datasheet below and the details of that record pop-up in the form above. They then put the number of parts they used in "QtyUsed" text box and hit update. This changes the "QtyOnHand" on the form. This all works great.

    My question is.....The "QtyOnHand" field in the datasheet view below does not update until you move to another record. Can I force it to update when the user clicks the "Update" button on the top part of the splitform?

    Thank You,
    Kevin

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Sounds like you need to save the record.

    DoCmd.RunCommand acCmdSaveRecord
    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
    Kevo is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Kodiak, Alaska
    Posts
    86
    Not sure where you wanted me to put that June7, but it didn't work in the On Click event.

    Here is what I have currently in the OnCLick event of the "Update" button.

    Private Sub btnUpdate_Click()
    Me.QtyOnHand = Me.QtyOnHand - Me.QtyUsed + Me.QtyReceived
    Me.QtyInTray = Me.QtyInTray - Me.QtyUsed + Me.QtyAddedTray
    Me.QtyAddedTray.Value = "0"
    Me.QtyUsed.Value = "0"
    Me.QtyReceived.Value = "0"

    Tried to add "Me.Requery" here and that instantly updates the datasheet but it also sends you back to the first record. So that wont work!
    End Sub

    Is there anything I can add to the bottom to update the datasheet part of the split form? Some kind of requery maybe?

    Thanks for any help!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    That is the conundrum with having aggregate calculations on a form. Ideally, data is entered without regard to totals and calculations are performed on reports.

    Try Refresh instead of Requery. But I think will have to commit record edits to table first. Record is committed when move to another record, close form, or acCmdSaveRecord.
    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
    Kevo is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Kodiak, Alaska
    Posts
    86
    Me.Refresh did the trick!

    Thanks June7. Awesome help here as usual!

    Kevin

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

Similar Threads

  1. Replies: 37
    Last Post: 08-10-2011, 09:43 AM
  2. Replies: 1
    Last Post: 01-22-2011, 12:23 PM
  3. Question about Northwind Splitform Controls
    By ajetrumpet in forum Forms
    Replies: 2
    Last Post: 09-13-2010, 09:08 PM
  4. Automatically update datasheet
    By tammiep in forum Forms
    Replies: 1
    Last Post: 08-17-2010, 04:43 PM
  5. Replies: 2
    Last Post: 01-29-2010, 11:30 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