Results 1 to 8 of 8
  1. #1
    Tari is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    36

    Report does not update properly

    Hey,

    my users are filling out a form and print a report after they are done. I have a problem with 2 of the amounts they enter -> Shipping & Handling, Taxes.

    The form shows the amounts, but when you click "View RTP for this order" the generated report shows 0$ in the field for s&h and taxes. You actually have to close the form and reopen it, hit the view button and then it displays correctly.

    the report pulls data from 3 different tables. Only the table including the taxes/s&h does not update properly.

    any idea how i can get that resolved?



    Thanks!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    It sounds like the record isn't yet saved. You can force a save with:

    DoCmd.RunCommand acCmdSaveRecord
    or
    If Me.Dirty Then Me.Dirty = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Tari is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    36
    Hey,

    sorry for not getting back to you earlier, I was busy at work. Where would I enter the code you gave me? Sorry.. I'm a noob

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    In the code for the button that runs the report, before opening the report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Tari is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    36
    I worked backwards from a template, as I have no clue how to write code. The code looks like this:

    Option Compare Database
    Private Sub cmdCloseOrderForm_Click()
    On Error GoTo Err_cmdCloseOrderForm_Click

    DoCmd.Close
    Exit_cmdCloseOrderForm_Click:
    Exit Sub
    Err_cmdCloseOrderForm_Click:
    MsgBox Err.Description
    Resume Exit_cmdCloseOrderForm_Click

    End Sub
    --------------------------------------------------------------------

    Private Sub Delete_Current_Order_Click()
    On Error GoTo Err_Delete_Current_Order_Click

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
    DoCmd.GoToRecord acDataForm, "Add Order and Details"
    Exit_Delete_Current_Order_Click:
    Exit Sub
    Err_Delete_Current_Order_Click:
    MsgBox Err.Description
    Resume Exit_Delete_Current_Order_Click
    End Sub
    --------------------------------------------------------------------
    Private Sub cmdAltOrder_Click()
    Dim altorder As String
    Dim numaltorder As Long
    altorder = InputBox("Enter the order number for which you want a summary", "Enter Order Number")
    If IsNumeric(altorder) Then
    numaltorder = CLng(altorder)
    If DCount("*", "[order details]", "[RTP number]=" & numaltorder) > 0 Then
    DoCmd.OpenReport "Orders Summary", acViewPreview, , "[OrderID]=" & numaltorder
    Else
    MsgBox "No summary is available for the order number you entered"
    End If
    Else
    MsgBox "Value entered is not a number"
    End If
    End Sub
    --------------------------------------------------------------------
    Private Sub cmdOrdersSummary_Click() <--- If I read this correctly, this one is for the button I'm talking about
    If DCount("*", "[order details]", "[RTP number]=" & Me.OrderID) > 0 Then
    DoCmd.OpenReport "Orders Summary", acViewPreview, , "[OrderID]=" & Me.OrderID
    Else
    MsgBox "No details have yet been added, so no summary is available"
    End If
    End Sub
    --------------------------------------------------------------------


    I'd appreciate if you could enter it for me and I copy it back there.

    Sorry for causing all this efford

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Either of the lines I posted can be pasted immediately before the DCount line. This should help you make sure you've got the right code:

    http://www.baldyweb.com/FirstVBA.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Tari is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Posts
    36
    That worked. Thanks a lot!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Excellent, glad it worked for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Cannot split a DB properly
    By Swarland in forum Access
    Replies: 3
    Last Post: 12-17-2010, 04:44 AM
  2. Replies: 1
    Last Post: 12-02-2010, 11:08 PM
  3. Delete SQL statement not working properly
    By Alexandre Cote in forum Programming
    Replies: 3
    Last Post: 10-18-2010, 12:56 PM
  4. Replies: 26
    Last Post: 09-27-2010, 09:48 PM
  5. Query on chart not working properly!
    By Sim_ in forum Queries
    Replies: 0
    Last Post: 10-28-2009, 09:38 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