Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to use Senkeys in MS Access 2007 while computer is locked

Posted on 2009-06-29
4
Medium Priority
?
303 Views
Last Modified: 2013-11-28
Hi.  I have an Access 2007 form which automatically at certain times sends a report in the body of the e-mail.  To have this automated, i have the outlook message displayed and then use SendKeys to Send "Alt S" to automatically send the e-mail.  Works fine while my computer is active, but i need this to occur while i'm not there as well.  Sendkeys will not work if the computer is locked.  I discovered this by coming in to work the next day after leaving it running to find 6 composed outlook messages on my desktop that did not send themselves.  Is there a way to use sendkeys while the computer is locked, or if not, is there an alternative method where the e-mails would send themselves while my computer is locked? Thanks.
0
Comment
Question by:liebs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:rizwanidrees
ID: 24742622
You can use Send() Function of outlook object to do the same without sendkeys
0
 
LVL 5

Accepted Solution

by:
rizwanidrees earned 2000 total points
ID: 24742646
  Dim Outlook As Object, OutlookMail As Object, Attachment As Object
   Set Outlook = CreateObject("Outlook.Application")
   Set OutlookMail = Outlook.CreateItem(0)
   Set Attachment = OutlookMail.Attachments
   OutlookMail.To = strTo
   OutlookMail.CC = strCC
   OutlookMail.BCC = strBCC
   OutlookMail.Subject = strSubject
   OutlookMail.Body = strBody
   Attachment.Add strAtt, 1, 1, "File Attachment"

Option - A
   'OutlookMail.Send

Option - B
   OutlookMail.Display
   SendKeys "%{s}", True
0
 
LVL 85
ID: 24743947
And SendKeys is notoriously unreliable. SendKeys will attempt to work on whatever is the "current" application, which can changes in a split second, depending on what's happening on the machine outside of Access. Do yourself a favor and use Option A that rizwanidrees suggests.
0
 

Author Closing Comment

by:liebs
ID: 31598229
This worked perfectly! Thank you so much for your help!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question