Record Update

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael Charney

    Record Update

    I have a form that is tied to a table. On this form I have a button that
    when clicked prints a report based on the information currently on the
    form. The problem is that unless the user tabs past the last control and
    moves to a new record, and then back to the record they just entered, the
    report prints blank.

    I know there is a way to update the record to the table without moving
    forward and back on the form, but I can not remember what it is. I think it
    is something about Rocord.Update but I can not find the exact command I am
    looking for.

    Anyone know how to do this?

    Mike Charney
  • Allen Browne

    #2
    Re: Record Update

    Set the Dirty property of the form, like this:
    Private Sub cmdPrint_Click( )
    Dim strWhere As String

    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If

    If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
    Else
    strWhere = "[ID] = " & Me.[ID]
    DoCmd.OpenRepor t "MyReport", acViewPreview, , strWhere
    End If
    End Sub--
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Michael Charney" <me@you.com> wrote in message
    news:FE%qd.2602 5$Rf1.23322@new ssvr19.news.pro digy.com...[color=blue]
    >I have a form that is tied to a table. On this form I have a button that
    > when clicked prints a report based on the information currently on the
    > form. The problem is that unless the user tabs past the last control and
    > moves to a new record, and then back to the record they just entered, the
    > report prints blank.
    >
    > I know there is a way to update the record to the table without moving
    > forward and back on the form, but I can not remember what it is. I think
    > it
    > is something about Rocord.Update but I can not find the exact command I am
    > looking for.
    >
    > Anyone know how to do this?
    >
    > Mike Charney[/color]


    Comment

    • Billie Kennedy Jr

      #3
      Re: Record Update

      you could also just go to the button control and before it does the
      report printing do:

      DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
      Me.Refresh

      Comment

      • Billie Kennedy Jr

        #4
        Re: Record Update

        I apologize if this ends up as a double post

        Try this, In your button event for printing put the following at the
        begining

        DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
        Me.Refresh


        --------------
        Billie


        Comment

        Working...