Question about EOF but in a form!!*332009

  • Thread starter Thread starter Earl.AKA J.Alladien in access forum!!
  • Start date Start date
E

Earl.AKA J.Alladien in access forum!!

Hi All,

I have a form with following code set on current(which is triggered
automatically by my timer on 3 seconds,so it runs automatically from record
to record) :

SEND = -1
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = Forms![Names1]![E-mail Address]
.Subject = Forms![Names1]![SUB]
.Body = Forms![Names1]![Body]
.SEND
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

I want the form to close automatically after the last record has been send
out,How do I do that?

Thanks in advance!
 
Hi All,

I have a form with following code set on current(which is triggered
automatically by  my timer on 3 seconds,so it runs automatically from record
to record) :

SEND = -1
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
    .To = Forms![Names1]![E-mail Address]
    .Subject = Forms![Names1]![SUB]
    .Body = Forms![Names1]![Body]
    .SEND
    '.ReadReceiptRequested
End With

Exit_Here:
    Set objOutlook = Nothing
    Exit Sub

Error_Handler:
    MsgBox Err & ": " & Err.Description
    Resume Exit_Here

I want the form to close automatically after the last record has been send
out,How do I do that?

Thanks in advance!

What record? There's no recordset open. Basically, you would have a
DoCmd.Close acForm, Me (not sure of the exact syntax, but it would go
after the recordset is closed that you're getting the records from.
 
Thanks for the response Piet,

My on timer event is as follows:

On Error GoTo Macro1_Err

DoCmd.GoToRecord acForm, "Names1", acNext


Macro1_Err:
Resume Next

So what I want to do is that when the last record(of my form) has reached I
would like the form to close after the last e-mail ( see my on current event)
has been send out!
Hope I explained it better now!



Piet Linden said:
Hi All,

I have a form with following code set on current(which is triggered
automatically by my timer on 3 seconds,so it runs automatically from record
to record) :

SEND = -1
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = Forms![Names1]![E-mail Address]
.Subject = Forms![Names1]![SUB]
.Body = Forms![Names1]![Body]
.SEND
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

I want the form to close automatically after the last record has been send
out,How do I do that?

Thanks in advance!

What record? There's no recordset open. Basically, you would have a
DoCmd.Close acForm, Me (not sure of the exact syntax, but it would go
after the recordset is closed that you're getting the records from.
 
Back
Top