Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle email attachments sent out overnight when the PC is locked

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
0
0
US
I have a nightly process which creates a report and emails it to the user.
When I arrive in the office in the morning, I login to my PC (locks up after 10 or so minutes of inactivity) the query runs and the email goes out to the user. Like i mentioned, I suspect this is because of the system security that the machine is locked when inactive. Am i doing something wrong or is this the way it is....when I am on vacation, I don't want to have to login each day to run the job.
 
Hi Pack10,

I don't see any replies but I'm wondering if you've figured out anything more about this scenario. I have an Access app that runs a timer event and am trying to figure out what happens when the user goes to lunch and leaves it running and their computer locks up after 10 minutes--does the app keep running the timer every minute or does it 'go to sleep' or something else?

thanks,

-- BoulderRidge B-)
 
Hi,

How is the procedure scheduled?

Are you security settings an issue?

I assume your process requires no user intervention.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi SkipVought,

In my case, every form has a TimerInterval of 60000 and an On Timer event procedure that looks like this:
Code:
Private Sub Form_Timer()
On Error GoTo ErrMe
Dim datNow As Date

'Only scheduler should trigger interview updates (else they will trigger multiple times per minute)
If GetUserRole() = gcintRoleScheduler Then
    datNow = Now()
    Call AdvanceMissedInterviews(datNow)
End If

ExitMe:

Exit Sub

ErrMe:
Call ShowError(Err.Number, Err.Description, "Form_Timer")
Resume ExitMe

End Sub

All it requires is for the user with the internal role of Scheduler to have their copy of the app open (role is assigned on launch and saved in a table local to the local front-end app). The AdvanceMissedInterviews call updates schedule data in the backend database which lives on a network share; the updates are done via linked tables (standard backend tables linked to frontend app). No user action is required to trigger this event.

I can't speak well to the security settings but here's what I know: the frontend app is put in a Trusted Location on the user's local laptop or tablet. The timer event is updating the data properly in general. However we get occasional reports of inconsistent behavior (another user isn't seeing updated results immediately, user claims value they entered was 'changed' by the system to a different value) so I'm trying to figure out precisely what environmental factors might be in play here. I'm not a network admin and can't seem to get anyone at this work site to help answer questions so far (they avoid Access stuff like the plague).

Thanks for your reply,

-- BoulderRidge B-)
 
I found a utility named Click Yes which does what I need.
Thanks for your response.
 
HOW does this solve your problem?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Outlook hangs waiting for a response. Click yes, is a system utility that simulates clicking the yes button on an email. Our PC's lock up after 10 minutes, so when i get to the office in the morning, the email has already gone out with the job, otherwise it would be waiting for me when i get in.
 
AVOID using Outlook for remote procedures!!!

Remote CLICK is an awful solution!

Use the CDO object instead.

I have an Excel procedure that runs @ 4:00, 14:00 and 21:00 7 days a week, 365 days per year and sends mail notices via CDO with each run.
Code:
Public Function CdoSend( _
    MailTo As String, _
    MailFrom As String, _
    Subject As String, _
    MessageText As String, _
    Optional CC As String, _
    Optional BCC As String, _
    Optional FileAttachment As String) As Boolean
On Error GoTo CdoSend_Err

' This example use late binding, you don't have to set a reference
' You must be online when you run the sub
    Dim oMsg As Object
    Dim oConf As Object
    Dim Flds As Variant
 
    Set oMsg = CreateObject("CDO.Message")
    Set oConf = CreateObject("CDO.Configuration")
 
        oConf.Load -1    ' CDO Source Defaults
        Set Flds = oConf.Fields
        With Flds
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "[b]YourMailServer[/b].com"
            .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
            .Update
        End With
 
    With oMsg
        Set .Configuration = oConf
        
        .To = MailTo
        .CC = CC
        .BCC = BCC
        .FROM = MailFrom
        
        .Subject = Subject
        .TextBody = MessageText

        
        If Len(FileAttachment & "") > 0 Then
            
            '## Last make sure the file actually exists and send it!:
            Dim fso
            Set fso = CreateObject("Scripting.FileSystemObject")
            If fso.FileExists(FileAttachment) Then
                .AddAttachment FileAttachment
            Else
                'otherwise return that the send failed and exit function:
                Debug.Print "[CdoSend.Error]=> File attachment path does not exist, quitting..."
                CdoSend = False
                Exit Function
            End If
        
        End If
    
        '## Send zee message! ##
        .sEnd
    
    End With

    Set fso = Nothing
    Set oMsg = Nothing
    Set oConf = Nothing
    
    CdoSend = True

CdoSend_Exit:
    Exit Function
    
CdoSend_Err:
    Debug.Print "[CdoSend.Error(" & Err.Number & ")]=> " & Err.Description
    CdoSend = False
    Resume CdoSend_Exit
End Function


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top