A family of Microsoft relational database management systems designed for ease of use.
How do you create a automatic 3 month email reminder or yearly reminder from access to outlook?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I keep getting this syntax error, missing operator in query expression [ID] = Soldering System. Can someone please help me?
Dim oOutlook As Outlook.Application
Dim oEmailAddress As MailItem
Dim MyEmpName As String
Dim temp As String
Dim MyEquip As String
Dim MyModel As String
Dim MyAsset As String
Dim MySerial As String
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset(MySQL)
If rs.RecordCount > 0 Then
rs.MoveFirst
Do Until rs.EOF
If IsNull(rs!EmailAddress) Then
rs.MoveNext
Else
If oOutlook Is Nothing Then
Set oOutlook = New Outlook.Application
End If
Set oEmailAddressItem = oOutlook.CreateItem(olMailItem)
With oEmailAddressItem
MyEmpName = DLookup("EmpName", "Employees", "[EmpID]= " & rs!EmpName)
MyEquip = DLookup("[EquipmentType]", "Equipment", "[ID]=" & rs!EquipmentType) This is the line where I keep getting that error message as well as the three Dlookup statements below.
MyModel = DLookup("ModelNo", "Equipment", "[ID]= " & rs!ModelNo)
MyAsset = DLookup("AssetNo", "Equipment", "[ID]= " & rs!AssetNo)
MySerial = DLookup("SerialNo", "Equipment", "[ID]= " & rs!SerialNo)
.To = "another@.com;another@.com;another@.com"
.Subject = "Calibration that's due between 1 to 11 months" & MyEmpName
.Body = "Calibration ID: " & rs!RecordID & vbCr & _
"Location: " & rs!CalLocation & vbCr & _
"Requirement: " & rs!Requirement & vbCr & _
"Employee: " & MyEmpName & vbCr & _
"Name: " & MyEquip & vbCr & _
"Serial No.: " & MySerial & vbCr & _
"Model No.: " & MyModel & vbCr & _
"Asset No.: " & MyAsset & vbCr & _
"Due Date : " & rs!CalUpcomingDate & vbCr & vbCr & _
"This email is auto generated. Please Do Not Replay!"
.Display
'.Send
' rs.Edit
' rs!DateEmailSent = Date
' rs.Update
End With
Set oEmailAddressItem = Nothing
Set oOutlook = Nothing
rs.MoveNext
End If
Loop
Else
'do nothing
End If
rs.Close
Exit_Function:
Exit Function
End Function
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
How do you create a automatic 3 month email reminder or yearly reminder from access to outlook?
I tried to do it that way, but it did not work for me at all. Thank you for your help.
Thank you so much=)
Hi,
try to change into:
MyEquip = DLookup("[EquipmentType]", "Equipment", "[ID]='" & rs!EquipmentType &"'")
Ciao Mimmo
It looks like rs!EquipmentType is a text field that contains the name of the equipment type, not its ID. So you may be able to use
MyEquip = rs!EquipmentType