Please can anyone tell me how I can create a macro to save the results
of a query as an excel file? The query is called Student List and I
would like to save it to "My Documents".
We have had some problems with our database crashing. We would
therefore like another way to have access to basic student data and
thought we automatically save the results of this query when we close
Access.
Any suggestions on how we could do this would be really appreciated
Thanks a lot
Carl
Oxford UK 5 24149
Hi Carl
Create a command button on your form (without using the wizard) and in the
On Click event type the following;
On Error Resume Next
DoCmd.OuptputTo, "Student List", acFormatXLS, "C:\My
Documents\Students.xls", False
For more details look at OutputTo in the help file.
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message
news:83**************************@posting.google.c om... Please can anyone tell me how I can create a macro to save the results of a query as an excel file? The query is called Student List and I would like to save it to "My Documents".
We have had some problems with our database crashing. We would therefore like another way to have access to basic student data and thought we automatically save the results of this query when we close Access.
Any suggestions on how we could do this would be really appreciated
Thanks a lot
Carl Oxford UK
Thanks Stewart. I couldn't get this to work but I was able to create a
macro and use the OutputTo action from there.
Please can you tell me if there is any way to automate this when a
user closes out of Access? And if so, does it matter if other users
have the database open at the same time?
TIA
Carl
"Stewart Allen" <sa****@REMOVETHISwave.co.nz> wrote in message news:<bn**********@news.wave.co.nz>... Hi Carl
Create a command button on your form (without using the wizard) and in the On Click event type the following;
On Error Resume Next DoCmd.OuptputTo, "Student List", acFormatXLS, "C:\My Documents\Students.xls", False
For more details look at OutputTo in the help file.
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message news:83**************************@posting.google.c om... Please can anyone tell me how I can create a macro to save the results of a query as an excel file? The query is called Student List and I would like to save it to "My Documents".
We have had some problems with our database crashing. We would therefore like another way to have access to basic student data and thought we automatically save the results of this query when we close Access.
Any suggestions on how we could do this would be really appreciated
Thanks a lot
Carl Oxford UK
Are there any error messages when using the code? Remove the "on error
resume next" line and see if any error messages pop up. The DoCmd.OutputTo
line is on one line, the newreader has wrapped the code to the next line. If
you want Excel to open the newly created file, change the False to True.
Yes there is a way to do this automatically when Access closes. If you have
a switchboard (which should be the first form to open) place the
DoCmd.OutputTo line in the Unload event of the switchboard form. If you have
several users opening the databse at the same time, consider splitting the
database into 2; one holds the tables only and is placed on a server or
dedicated PC, and every user has their own copy of the user interface on
their own PCs. These contains all the forms, queries, reports etc and have
linked tables to the backend. Check this link for more details http://members.iinet.net.au/~allenbrowne/ser-01.html
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message
news:83*************************@posting.google.co m... Thanks Stewart. I couldn't get this to work but I was able to create a macro and use the OutputTo action from there.
Please can you tell me if there is any way to automate this when a user closes out of Access? And if so, does it matter if other users have the database open at the same time?
TIA
Carl
"Stewart Allen" <sa****@REMOVETHISwave.co.nz> wrote in message
news:<bn**********@news.wave.co.nz>... Hi Carl
Create a command button on your form (without using the wizard) and in
the On Click event type the following;
On Error Resume Next DoCmd.OuptputTo, "Student List", acFormatXLS, "C:\My Documents\Students.xls", False
For more details look at OutputTo in the help file.
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message news:83**************************@posting.google.c om... Please can anyone tell me how I can create a macro to save the results of a query as an excel file? The query is called Student List and I would like to save it to "My Documents".
We have had some problems with our database crashing. We would therefore like another way to have access to basic student data and thought we automatically save the results of this query when we close Access.
Any suggestions on how we could do this would be really appreciated
Thanks a lot
Carl Oxford UK
Hi Stewart,
I have split the database so that the back end sits on the server and
everything else is in "My Documents". I am trying to add the code to
the Switchboard Unload Event. From the Properties window I clicked
next to On Unload
and then on the button with the three dots. This took me to the VBA
editor and I pasted the following
On Error Resume Next
DoCmd.OuptputTo , "Student List", acFormatXLS, "C:\My
Documents\Students.xls", False
into the function that had been created to give:(the False is on the
same line as the DoCmd)
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
DoCmd.OuptputTo , "Student List", acFormatXLS, "C:\My
Documents\Students.xls", False
End Sub
I now get a Compile error:
Method or Data Member not found
when I try to close the database
Please can you offer any suggestions?
TIA
Carl
"Stewart Allen" <sa****@REMOVETHISwave.co.nz> wrote in message news:<bn**********@news.wave.co.nz>... Are there any error messages when using the code? Remove the "on error resume next" line and see if any error messages pop up. The DoCmd.OutputTo line is on one line, the newreader has wrapped the code to the next line. If you want Excel to open the newly created file, change the False to True.
Yes there is a way to do this automatically when Access closes. If you have a switchboard (which should be the first form to open) place the DoCmd.OutputTo line in the Unload event of the switchboard form. If you have several users opening the databse at the same time, consider splitting the database into 2; one holds the tables only and is placed on a server or dedicated PC, and every user has their own copy of the user interface on their own PCs. These contains all the forms, queries, reports etc and have linked tables to the backend. Check this link for more details http://members.iinet.net.au/~allenbrowne/ser-01.html
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message news:83*************************@posting.google.co m... Thanks Stewart. I couldn't get this to work but I was able to create a macro and use the OutputTo action from there.
Please can you tell me if there is any way to automate this when a user closes out of Access? And if so, does it matter if other users have the database open at the same time?
TIA
Carl
"Stewart Allen" <sa****@REMOVETHISwave.co.nz> wrote in message news:<bn**********@news.wave.co.nz>... Hi Carl
Create a command button on your form (without using the wizard) and in the On Click event type the following;
On Error Resume Next DoCmd.OuptputTo, "Student List", acFormatXLS, "C:\My Documents\Students.xls", False
For more details look at OutputTo in the help file.
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message news:83**************************@posting.google.c om... > Please can anyone tell me how I can create a macro to save the results > of a query as an excel file? The query is called Student List and I > would like to save it to "My Documents". > > We have had some problems with our database crashing. We would > therefore like another way to have access to basic student data and > thought we automatically save the results of this query when we close > Access. > > Any suggestions on how we could do this would be really appreciated > > Thanks a lot > > Carl > Oxford UK
This sounds like a referencing problem. What version of access are you
using? While in the VBA editor goto Tools>References and list all the items
that are ticked. Also while you're in the editor goto Debug and click
Compile. What is the line of code that is highlighted in yellow? Copy and
paste that block of code into your reply message and indicate which line was
highlighted.
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message
news:83**************************@posting.google.c om... Hi Stewart,
I have split the database so that the back end sits on the server and everything else is in "My Documents". I am trying to add the code to the Switchboard Unload Event. From the Properties window I clicked next to On Unload and then on the button with the three dots. This took me to the VBA editor and I pasted the following
On Error Resume Next DoCmd.OuptputTo , "Student List", acFormatXLS, "C:\My Documents\Students.xls", False
into the function that had been created to give:(the False is on the same line as the DoCmd)
Private Sub Form_Unload(Cancel As Integer) On Error Resume Next DoCmd.OuptputTo , "Student List", acFormatXLS, "C:\My Documents\Students.xls", False
End Sub
I now get a Compile error: Method or Data Member not found
when I try to close the database
Please can you offer any suggestions?
TIA Carl
"Stewart Allen" <sa****@REMOVETHISwave.co.nz> wrote in message
news:<bn**********@news.wave.co.nz>... Are there any error messages when using the code? Remove the "on error resume next" line and see if any error messages pop up. The
DoCmd.OutputTo line is on one line, the newreader has wrapped the code to the next
line. If you want Excel to open the newly created file, change the False to True.
Yes there is a way to do this automatically when Access closes. If you
have a switchboard (which should be the first form to open) place the DoCmd.OutputTo line in the Unload event of the switchboard form. If you
have several users opening the databse at the same time, consider splitting
the database into 2; one holds the tables only and is placed on a server or dedicated PC, and every user has their own copy of the user interface on their own PCs. These contains all the forms, queries, reports etc and
have linked tables to the backend. Check this link for more details http://members.iinet.net.au/~allenbrowne/ser-01.html
Stewart
"Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message news:83*************************@posting.google.co m... Thanks Stewart. I couldn't get this to work but I was able to create a macro and use the OutputTo action from there.
Please can you tell me if there is any way to automate this when a user closes out of Access? And if so, does it matter if other users have the database open at the same time?
TIA
Carl
"Stewart Allen" <sa****@REMOVETHISwave.co.nz> wrote in message news:<bn**********@news.wave.co.nz>... > Hi Carl > > Create a command button on your form (without using the wizard) and
in the > On Click event type the following; > > On Error Resume Next > DoCmd.OuptputTo, "Student List", acFormatXLS, "C:\My > Documents\Students.xls", False > > > For more details look at OutputTo in the help file. > > Stewart > > > "Carl" <ca*********@oxmhc-tr.nhs.uk> wrote in message > news:83**************************@posting.google.c om... > > Please can anyone tell me how I can create a macro to save the
results > > of a query as an excel file? The query is called Student List and
I > > would like to save it to "My Documents". > > > > We have had some problems with our database crashing. We would > > therefore like another way to have access to basic student data
and > > thought we automatically save the results of this query when we
close > > Access. > > > > Any suggestions on how we could do this would be really
appreciated > > > > Thanks a lot > > > > Carl > > Oxford UK This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: LBT |
last post by:
Hi experts,
With response.contenttype = "application/vnd.ms-excel", I can easily export
my data to Excel which is embeded and shown within a browser.
If I'm going to save the Excel file...
|
by: Ed Bangle |
last post by:
Hi everyone,
I desparately need help. I have an excel file that I
cannot convert to XML because of the VB code wrapped into
the file and the calculations in each cell. I need to
attach all of...
|
by: mattmerc |
last post by:
Hi all,
We have all seen lot of method for exporting datagrids to Excel. I have
a slightly different need. I think it should be easy to accomplish but
I am not sure how. I would like when a user...
|
by: alwayssmiling |
last post by:
Hi frends,
In my application, a class supports backend processing. In this class im creating a new excel sheet and im inserting some data into this excel sheet, and im trying to save the file...
|
by: NBKMNDN |
last post by:
Hi frends,
In my C# application im creating a new excel sheet and im inserting some data into this excel sheet, and im trying to save the file with the help of method SAVE AS. But it doesnot...
|
by: =?Utf-8?B?Tml5YXpp?= |
last post by:
Hi all,
Does anyone know how to embed the Excel file in VB.NET 2005 Resources?
Here is what I am doing at the moment:
1) In my VB.NET 2005 project code I load the excel with it path into...
|
by: shantanu |
last post by:
Hi all
i am trying to save a excel file as a tab delimited text file. can i
do it some how?
i using the code
_sheet1.SaveAs(@"C:\PRP
\PRPTemp.txt",Excel.XlFileFormat.xlTextWindows...
|
by: roswara |
last post by:
Dear all,
Currently, I am working on a project to make a web-based application using ASP 2.0 and C#. This application will ask user to input for an excel file which has graphs in it. Then the...
|
by: Rodthemod |
last post by:
Hi All
I wish to send excel files to other company staff - but save the file as values (so not showing all my formulae links etc )
Please help
Thanks in advance
Kind regards
|
by: Happy Zoe |
last post by:
Can anyone help me for this? I am going to open an excel file when click a hyperlink using asp. But when i click the hyperlink, it can't be open. If i delete the macro inside the excel file, it can...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |