Hi There!
You can consider me an intermediate in Access and I need your expert advice/help. I'm working on a due date form that would pull the information based on the date range specified. I have put the following and but when I open the form it gives me the error message "The expression On Timer you entered as the event property setting produced the following error: Method or data member not found." What am I missing?
Private Sub Form_Timer()
Me.TimeText.Value = Format(Time, "HH:mm:ss AM/PM")
Static iCount As Interger
iCount = iCount + 1
If iCount = 60 Then
Me.TimerInterval = 0
Call generateemail("SELECT * FROM Query1_due_date_Subform")
If Me.TimerInterval = 0 Then
Me.TimerInterval = 125
End If
Exit Sub
End If
End Sub
Also, when I click on the form it's supposed to send automated emails. Below is the AutoEmail module created:
Function AutoEmail(MySQL As String)
'On Error GoTo Exit Function:
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset(MySQL)
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
If IsNull(rs!Email) Then
rs.MoveNext
Else
'Set oOutlook = GetObject(, "Outlook.Application")
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(lEmailItem)
With oEmailItem
.To = rs!Email
.Subject = "Collaboration Project Expires in 30 days Reminder for " & rs!Collaboration_Owner
.Body = "CA Record #: " & rs!CA_Record_# & vbCr & _
"Institution: " & rs!Institution & vdCr & _
"Collaboration Owner: " & rs!Collaboration_Owner & vbCr & _
"PA Expiration Date: " & rs!PA_Expiration_Date & vbCr & vbCr & _
"This email is auto generated from the PMCD Collaboration Projects Database. Please Do Not Reply!"
.Display
' .Send
' rs.Edit
' rs!OnemonNotify = Date
' rs.Update
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
rs.MoveNext
End If
Loop
Else
' do nothing
End If
Would appreciate your suggestion/advice. Please note that I'm not quite into the Access terms yet. Would appreciate if you can tell me in layman's terms.
Maria
You can consider me an intermediate in Access and I need your expert advice/help. I'm working on a due date form that would pull the information based on the date range specified. I have put the following and but when I open the form it gives me the error message "The expression On Timer you entered as the event property setting produced the following error: Method or data member not found." What am I missing?
Private Sub Form_Timer()
Me.TimeText.Value = Format(Time, "HH:mm:ss AM/PM")
Static iCount As Interger
iCount = iCount + 1
If iCount = 60 Then
Me.TimerInterval = 0
Call generateemail("SELECT * FROM Query1_due_date_Subform")
If Me.TimerInterval = 0 Then
Me.TimerInterval = 125
End If
Exit Sub
End If
End Sub
Also, when I click on the form it's supposed to send automated emails. Below is the AutoEmail module created:
Function AutoEmail(MySQL As String)
'On Error GoTo Exit Function:
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset(MySQL)
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
If IsNull(rs!Email) Then
rs.MoveNext
Else
'Set oOutlook = GetObject(, "Outlook.Application")
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailItem = oOutlook.CreateItem(lEmailItem)
With oEmailItem
.To = rs!Email
.Subject = "Collaboration Project Expires in 30 days Reminder for " & rs!Collaboration_Owner
.Body = "CA Record #: " & rs!CA_Record_# & vbCr & _
"Institution: " & rs!Institution & vdCr & _
"Collaboration Owner: " & rs!Collaboration_Owner & vbCr & _
"PA Expiration Date: " & rs!PA_Expiration_Date & vbCr & vbCr & _
"This email is auto generated from the PMCD Collaboration Projects Database. Please Do Not Reply!"
.Display
' .Send
' rs.Edit
' rs!OnemonNotify = Date
' rs.Update
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
rs.MoveNext
End If
Loop
Else
' do nothing
End If
Would appreciate your suggestion/advice. Please note that I'm not quite into the Access terms yet. Would appreciate if you can tell me in layman's terms.
Maria