I am trying to develop a database where teachers log an application for when they need a lesson to be covered (I'd do this in SQL but I can't currently).
I would like the database to notify a certain member of staff when an application is made. Selecting the member of staff would be done from a combobox, driven by a query. The reason for the query is that I only want specific members of staff to receive this notification - essentially those who manage other staff.
Once that member of staff has been selected, I want the person making the application to click a button, which will then fire an email to the person selected in the combobox.
I get a flicker of Outlook doing something and then nothing.
This is what I have so far, with the DLookup using the staff member selected in the combobox to then find the email address in the Staff table:
Private Sub Command788_Click()
Dim Email_Note As Variant
Email_Note = DLookup("Email", "Staff", Forms![Cover Application Form]!Combo767)
Dim olLook As Outlook.Application
Dim olNewEmail As Outlook.CreateItem
Dim StrContactEmail As String
Set olLook = New Outlook.Application
Set olNewEmail = olLook.CreateItem(olMailItem)
strEmailSubject = "Application for Cover: Line Manager Notification"
strEmailText = "Something in here..."
StrContactEmail = "Email_Note"
olNewEmail.Display
End Sub
Dim olNewEmail As Outlook.CreateItem
should beOutlook.MailItem
– AndrestrEmail
variables don't do anything. Look here for a start: stackoverflow.com/q/17973549/3820271 – Andre