Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Location
    Canada
    Posts
    2

    Unanswered: Print/Preview button created on form

    Hi,

    I am working with Access 2003. I have created a Print/ Preview Button on a form which previews a report with work request data. If a user enters in new data and clicks the button, the report comes up empty. If the user after entering data, goes to another data record and goes back to the record that they enter, they are able to get the data.

    Is there any code to allow the new data to be capture?


    Here is the code that I am currently working with:


    Private Sub cb_PreviewSingleRequestForm_Click()
    ' Done by scott

    On Error GoTo Err_Preview_Single_Work_Request_Report_Click

    Dim stDocName As String

    stDocName = "work request form - one at a time"

    DoCmd.OpenReport stDocName, acPreview, , , , Me.work_request_number



    Exit_Preview_Single_Work_Request_Report_:
    Exit Sub

    Err_Preview_Single_Work_Request_Report_Click:
    MsgBox Err.Description
    Resume Exit_Preview_Single_Work_Request_Report_

    End Sub

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Uh ... No. The data entered is not saved to disk anywhere where a query could pull it. You gotta save it 1st before access can retrieve it to put in a report.
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Dim stDocName As String

    stDocName = "work request form - one at a time"

    DoCmd.OpenReport stDocName, acPreview, , , , Me.work_request_number
    Just a note that I was taught. Try naming your objects without the S P A C E S in between. That can in time become hard to manage. Food for thought. And just for curiosity...what does the "one at a time" mean?? To follow standard naming conventions forms are normally prefixed with "frm" so your form would be "frmWorkRequest". Food for thought what has been passed on to me.
    Have a nice day,
    Bud

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •