forms and excel

  • Thread starter Thread starter Lindsay
  • Start date Start date
L

Lindsay

I need to create a link so that I can copy the current
record I am looking at in a form over to excel. Is there
a way to do this. The only thing I have found so far
copies all of the records in the form, not just the one!

Please help!!!
Lindsay
 
Hi Lindsay,

This can be done in various ways depending on just what you want to
achieve.

If you want to create a new workbook that contains just the data from
the current record, you can do it as follows:

1) Create a parameter query that gets its data from the same source as
the form and its parameter from the form. For instance, if the form for
is frmXXX, its recordsource is query qryYYY, the primary key is field
PK, and PK is displayed on the form in a textbox named txtPK:
- create a query based on qryYYY
- add all the fields you want to export
- in the "Where" row of the query design grid, in the PK
column, put
[Forms]![frmXXX]![txtPK]
2) Open the form and find the record you want to export.
3) Open the query (it should show just that one record) and export it.

Otherwise - e.g. if you want to export individual records into
successive rows of an Excel sheet - you may need to use Automation. This
is a useful article giving the basics of controlling Excel from Access:
Sample Excel automation
http://www.mvps.org/access/modules/mdl0006.htm

The following Microsoft Knowledgebase articles are helpful too:
ACC: Sending the Current Record to Word 97 with Automation (Q131583)
http://support.microsoft.com/?id=131583

Using Microsoft Access as an Automation Server
http://support.microsoft.com/?id=147816
http://support.microsoft.com/?id=210111 (Access 2000 and later)

Q123859 ACC: Sample OLE Automation for MS Word and MS Excel
http://support.microsoft.com/?id=123859

ACC2000: Using Automation to Create and Manipulate an Excel Workbook
(Q210148) http://support.microsoft.com/?id=210148

ACC: Using Automation to Create and Manipulate an Excel Workbook
(Q142476)
http://support.microsoft.com/?id=142476





Also, search www.mvps.org/access
 
Back
Top