create button do number

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Create a button to do a number of functions | Access forum

Create a button to do a number of functions | Access forum

resolvedResolved · Low Priority · Version 2007

Sarah has attended:
Excel VBA Intro Intermediate course
Access Advanced course
Access Intermediate course

Create a button to do a number of functions

I want to create a button on a form that does a number of functions.

1) to run a query (the query is already setup, it basically selects all records in one table for a given time period which the user enters)
2) the data is saved as an excel/csv file
3) and then inserted into an open email

Can this be done or am I getting too complicated?

Thanks,
Sarah

RE: Create a button to do a number of functions

Hi Sarah, thanks for your query. Thank can certainly be done but the first question is whether you want to do this from within Access or Excel? Either way, you are going to need code to contact the Outlook object model which is something we do on our Advanced course and is a bit beyond the scope of this forum. However, have a look at this link for pointers on how to export from Access to a csv file:

http://social.msdn.microsoft.com/Forums/en/isvvba/thread/d5432b8e-08f6-4b6a-b13d-fc7656970704

Hope this helps,

Anthony

RE: Create a button to do a number of functions

Hi

I've completed the Advanced course and didn't come across the Outlook Object - I guess it depends on the trainer and the trainees as to whats covered on the day.
I'll see if I can give it a whirl.

Thanks,
Sarah

RE: Create a button to do a number of functions

Oh and I'm wanting to do this in Access

RE: Create a button to do a number of functions

Hi Sarah. We address connecting to Outlook on the Advanced Excel VBA course, not the Access course, which is why you may not have come across it. Here are two links, the first with a good suggestion on linking an Excel CSV file as a table in Access and then running an append query to it:

http://bytes.com/topic/access/answers/868486-export-query-result-csv-file

...and the second discussing emailing from within Access VBA:

http://www.ozgrid.com/forum/showthread.php?t=89441& ;page=1

Hope this helps,

Anthony

RE: Create a button to do a number of functions

Hi,

I've managed to do it using the macro facility.
I basically selected 'Open Query', followed by 'Send Object' then 'Close' and it works perfectly - I didn't even have to write any code.

Thanks for the links they were very helpful.

Sarah

RE: Create a button to do a number of functions

Excellent! The simplest solution is always the best. Glad to be of help.

Anthony

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Related tables

When you have related tables such as Customers and their Orders, the Customer table is the Primary table.

Open the Customers table in datasheet view and go to the Home Tab and Records group. Click on the More option and choose Subdatasheet and then click on Subdatasheet again. Now choose the related table (Orders) and click ok.

Now you can click the + symbol by each company to show the related orders.

View all Access hints and tips


Server loaded in 0.08 secs.