Assuming you want to export the results of a query:
If you create a command button on a form and attach the following command to the Click event, you will create from the chosen query an Excel file. This will export itself and overwrite any existing (named) file found in the destination folder.
I tried this earlier:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "Results", "C:\windows\desktop\project\fiberdb.xls", False, "Results"
This adds new sheet to this FiberDB file named as "Results1". I would like this to overwrite whole sheet OR I could delete old "Results" sheet from FiberDB and add whole new "Results" sheet in it with this docmd(if it is possible).
Maybe its worth looking at this from the other side...rather than exporting, create a link back from your Excel file to the db.
I found the following help notes in Excel which may be relevant:
To bring external data into Microsoft Excel, you must:
· Have access to an external data source. If the data you want access to is not on your local computer, you may need to see the administrator of the external database for a password, user permission, or other information about how to connect to the database.
· Install Microsoft Query. Microsoft Query is an optional feature for Microsoft Excel and includes the Query Wizard. To create a query in Microsoft Query, you must install it separately. For more information, click .
· Install an ODBC driver for your data source. An ODBC driver is required to retrieve data, including data in Microsoft Excel. To run a query file, you do not need to install Microsoft Query, but you must have the appropriate ODBC driver installed for your data source.
Unless you changed options when you installed Microsoft Query, Setup automatically installed three ODBC drivers that allow you to retrieve data from dBASE, Microsoft Access, and Microsoft Excel. In addition, you could have installed other ODBC drivers at that time. For a list of the available ODBC drivers that you can install, click .
If you did not previously install an ODBC driver for a data source that you want to use, you must install it separately. For more information, click .
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.