Results 1 to 2 of 2
  1. #1
    l8poulse is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1

    Question Printing a form


    I've created a tabbed form that I'm using for auditing purposes. When the form is complete I want the user to print off a copy off the form showing all the fields. I've not had sucess with this and so my next option would be once the form is completed, the user would click a print button where a macro would be built in the back end that would export the contents to a report and print the report. When I try creating the report, I have too many fields. I would love to condense the fields by all must be displayed for review. Is there a way that I can export the contents to an Excel spreadsheet and print from there?

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    printing forms is not the general practice. Generally reports are printed. Regarding data to be exported to Xcel:

    I have a Form connected to a table tbltech. i have a form with this table as the record source. when i click a button on the form the particular data on the form is exported on to an excel sheet.

    the code is as follows:

    Dim strSQL As DAO.QueryDef
    Dim strdpSQL As String

    strdpSQL = "Drop Table MyQuery"
    On Error Resume Next
    CurrentDb.Execute strdpSQL, dbFailOnError

    Set strSQL = CurrentDb.CreateQueryDef("MyQuery", "Select * From tbltech Where techid=" & Me.techid)
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "MyQuery", "C:\MyReport.xls", True

    I First Create a Query using CreateQueryDef and the Use Docmd.TransferSpreadSheet to export the Data to an Excel Sheet called MyReport (C:\MyReports.xls). If you Look at the code carefully you will notice that I make sure that I drop the Query MyQuery before I run the SQL to Create the same. This is to eensuer that we get no error. I have used On error Resume Nsxt to prevent error when the code is run for the first time when MyQuery is not there.

    If this solves your problem amrk the thread solevd. please let me know if you wil nedd any more help.

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

Similar Threads

  1. Printing report from Form
    By cotri in forum Access
    Replies: 8
    Last Post: 05-24-2013, 12:01 PM
  2. form printing
    By nkuebelbeck in forum Forms
    Replies: 4
    Last Post: 04-01-2010, 01:39 PM
  3. Printing Form
    By linjoye in forum Reports
    Replies: 1
    Last Post: 02-19-2010, 08:09 PM
  4. Replies: 16
    Last Post: 06-03-2009, 07:01 AM
  5. Printing all tabs on one form
    By sshafer1 in forum Access
    Replies: 0
    Last Post: 12-06-2007, 07:47 PM

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