Exporting specific fields by using VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to write a piece of VBA code that will export the values
contained within specific fields of a form and export them to Excel?

For example, if I had three fields on a form called frm_TEST:

Field A, Field B, Field C

After running a calculate button also contained on frm_TEST, three different
values pop up in Field A-C. I wanted to have another button on the form
that, if pressed, took those number values and exported them into column B of
an Excel workbook called TEST.xls. If there is a genius out there who can
help me, it would be greatly appreciated. Thanks.
 
Does anyone know how to write a piece of VBA code that will export the values
contained within specific fields of a form and export them to Excel?

For example, if I had three fields on a form called frm_TEST:

Field A, Field B, Field C

After running a calculate button also contained on frm_TEST, three different
values pop up in Field A-C. I wanted to have another button on the form
that, if pressed, took those number values and exported them into column B of
an Excel workbook called TEST.xls. If there is a genius out there who can
help me, it would be greatly appreciated. Thanks.

First off...

Forms do not contain data. You can't export the values of FieldA,
FieldB, FieldC from a Form (other than the single record currently
being displayed). A form *is just a window*, a tool; data is stored in
Tables, and calculated in Queries.

I'd suggest that rather than calculating these values on a Form, that
you do so in a Query; you can then use File... Export to manually
export the data in the query to Excel, or write code using the
TransferSpreadsheet method to export the query data.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top