on a form in access, I open up a rst and want to send a report to all in a database table list.

It all works and opens outlook and will send it but, it shows the security thing>>>

after I click "allow", it goes ahead and puts the 1st email in "outbox".

then, access moves on the the 2nd report and then , it shows the security thing>>>

after I click "allow", it goes ahead and puts the 2nd email in "outbox".

then, access moves on the the 3rd report and then

etc.. I really don't want the user to have to wait and click this 37 times to complete the task..

I have looked at security on the internet for outlook 2007 but, I can't find anything I can use that works.

I don't want to purchase anything like …..

Advanced Security for Outlook says it will work.. but, I can't get it to do anything..

what can I do.

is there any code I can run in outlook or access 2007 that will let it step thru and send 37 emails to the individuals ??

You might be able to use the following API's in conjunction with your access code.

FindWindow (to find outlook's hwnd)
EnumChildWindows (to find outlooks dialog and to find the ok buttons hwnd)
SendMessage with a WM_BUTTONDOW/WM_BUTTONUP messages to click the button...

There are a few examples out there on all of these api's you will just need to use your friends (yahoo, google, ask, answers, bing).

Good Luck

thanks for the suggestion about api
i don't know how to do it, please show me how to do it..
my code is attached for cmd button
*********

Private Sub Command0_Click()
'MsgBox " ENTERED"
'MsgBox "[Rep EID] =" & [Rep EID]
    Dim rst As Recordset
    Dim strSQL As String
    Dim DBS As Database
    Set DBS = CurrentDb
    'Reps and Mgrs - Comm Named
    strSQL = "SELECT * FROM [Reps and Mgrs - Comm Named]  "  'where [Rep EID]= '20333227'"
    Set rst = DBS.OpenRecordset(strSQL)
    '*******************************8
    rst.MoveFirst
    rst.MoveLast
    'MsgBox " RECORD COUNT IS = " & rst.RecordCount
    rst.MoveFirst
    '**********************************
While (Not (rst.EOF))
    'MsgBox "[Rep EID] = " & rst![Rep EID]
    'MsgBox "Email Address= " & rst![Email Address]
    'MsgBox "FY10 Roster name is = " & rst![FY10 Roster]
    '*********************************
    Me.FilterID = rst![Rep EID]
    'MsgBox " Me.FilterID = " & Me.FilterID
'this opens report for each indivdual
        DoCmd.OpenReport "Acct Notification Letter", acPreview, , "[Rep EID] = [Forms]![FRM_SEND FY10 U S Account Notification report to each]![FilterID]"
'this sends report via outlook for each indivdual
        DoCmd.SendObject acSendReport, "Acct Notification Letter", acFormatPDF, rst![Email Address], , , "Acct Notification Letter for " & rst![FY10 Roster], "Attached is your Account Notification monthly report...", False

'**************************
FindWindow (to find outlook's hwnd)
EnumChildWindows (to find outlooks dialog and to find the ok buttons hwnd)
SendMessage with a WM_BUTTONDOW/WM_BUTTONUP messages to click the button...
'***************************

'this closes the open report for each indivdual

DoCmd.Close acReport, "Acct Notification Letter"
              rst.MoveNext
        Wend
    rst.Close
    DBS.Close
'that's all folks
End Sub

Edited 6 Years Ago by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode]

There are a few examples out there on all of these api's you will just need to use your friends (yahoo, google, ask, answers, bing).

This article has been dead for over six months. Start a new discussion instead.