create button do number
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

Create a button to do a number of functions

resolvedResolved · Low Priority · Version 2007

replyReply Tue 18 Jan 2011, 16:37Delegate Sarah said...

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

For upcoming training course dates see: Pricing & availability

replyReply Wed 19 Jan 2011, 09:44Trainer Anthony said...

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

replyReply Wed 19 Jan 2011, 09:56Delegate Sarah said...

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

replyReply Wed 19 Jan 2011, 09:56Delegate Sarah said...

RE: Create a button to do a number of functions

Oh and I'm wanting to do this in Access

replyReply Wed 19 Jan 2011, 10:03Trainer Anthony said...

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

replyReply Wed 19 Jan 2011, 10:56Delegate Sarah said...

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

replyReply Wed 19 Jan 2011, 10:59Trainer Anthony said...

RE: Create a button to do a number of functions

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

Anthony

 

Please browse our web site to find out more about
access courses and other Microsoft training courses.

Access tip:

Combo box for finding records

You can use a combo box in a form to look up a record. If you place the comb box in the Form header, by then selcting they a field type from the drop down loist, you will see the record for it

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard