Hi,
I apologise for all I am asking, but I am a little rusty (about 12 years since I last used Access), and I am slowly getting back to grips! Things were a lot different back then!
I also apologise for any confusion as I have Aspergers, and sometimes say things in my head instead of communicating what I wanted to say!
Iam trying to develop an "Internal Email" form to email [Employees] using Gmail via a module.
So far I have made a table of emaployees and picked a macro from this forum.
There are lots of things I need to know how to do, but mainly I need a search utility for multiple fields from records in a table that will allow the user to place a different field associated to the record found/selected by the user
ie: search [firstname] & [lastname] fields, and upon selecting required record from query results, output [email] field to a textbox (may likely need results that can be used as multiple selections with comma seperated outputs upon selection)
My overall goal here is to create a textbox in the form that will look up the [FirstName] and [SecondName] fields at the same time, and (if not too much work for you!) show the results as you type as a checklist.
in other words I want the results to display as a tickbox selection list with the results like so:
Table field data:
[FirstName] & " " & [Lastname] "(ID: " & [EmployeeID]
Text Output:
□ John Smith (ID:1)
□ John Doe (ID:2)
When this list comes up, I would like to be able to select multiple names that when selected, will have each record's respective Email address [Email] added into a "To" textbox, ready to be read by the email module for when the email is sent.
I am also having trouble with the button I want to use to send the email, I cannot seem to figure out how to get the macro I am using to identify the [To], [Subject] & [Body] details.
Here is my module (as you can see I have tinkered with it a little, and this was working when I first made my form in the simplest setting):
Public Function send_email()
Set cdomsg = CreateObject("CDO.message")
With cdomsg.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'NTLM method
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 465
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "benjamin.goddard@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "forgetm3n0t"
.Update
End With
' build email parts
With cdomsg
.To = EmployeeEmail.EmailTo, "benjamin.goddard@gmail.com"
.From = "ben@leeli.co.uk"
.Subject = EmployeeEmail.EmailSubject 'was with "subject here"
.TextBody = EmployeeEmail.EmailBody 'was "the full message body goes here. you may want to create a variable to hold the text"
.Send
End With
Set cdomsg = Nothing
End Function
You might also notice I set the Email button to save a record of the Email, as eventually I will be making a complete email suite with an inbox and outbox etc
Anyway, I have made a new Database and imported the stuff that you might need to look at to help!
Thanks in advance peepz!
Ben