Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Posts
    11

    Unanswered: Export Current Record

    How can I export just the current record via a command button on a form? I have it set up to export, but it exports every record, not just the current.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Create a query based on the data you want to export. In the criteria of the ID field put..

    [forms]![frmYourForm]![ID]

    changing "frmYourForm" to the name of the form in question and "ID" to the control on the form that holds the ID.
    In the OnClick event of your button put the following code (if you are importing to Excel)

    Code:
    DoCmd.TransferDatabase acExport, acSpreadsheetTypeExcel9, "YourQuery", "C:\YourSpreadsheet.xls", True
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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