http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-Without-Security-Warning
A way to get around the Security warnings without 3rd party applications like Clickyes and yes pro.
You will also need to change your open method from what is shown in order for your record counts to work properly.
with RST
.Open "SELECT COUNT(*) FROM " & tbl, cnn, adOpenKeyset, adLockOptimistic
num = .Fields(0)
.Close
End With
would need to be replaced with
with RST...
You can run a macro that is in an Excel Workbook from Access.
objXL.Application.Run "TestMacros.xls!Macro1"
where "TestMacros.xls" is the name of the excel file and "Macro1" is the name of the macro.
How many different databases do you have to make this change in?
The replace function (edit menu or ctrl + H) in the VBA IDE can replace all instances in all modules, including Form Modules and class modules.
Or, and I'm not good enough to do this, but I believe it may be worth looking into...
Another thing that I do when I work with excel is I record a macro in excel to do what I want it to do. This automagically generates all the code required to do the task that I want to do, because I'm doing it manually. Then I copy / paste the macro into Access and modify it for exactly what I...
I took out your _'s and put my own folder in there and it works like a charm. I also made it a function instead of a sub.
Public Function CreateFolder(JobName As String)
Dim FolderPath As String
FolderPath = "C:\Testit\" & JobName
MkDir (FolderPath)
End Function
You also need a way out of your code because 2200 is going to be < 11000, so that code is going to run, but so is all of your other code because 2200 is also less than everything else. So after you are done processing in each Case statement you need to put an exit sub/function statement.
There are many other examples on this forum of how to work with a recordset.
Just remember that you only get one row at a time, and you have to loop thru it to get all of your email addresses.
Here's one I gave just yesterday...
dim rs as ADODB.Recordset
Set cnn = New ADODB.Connection
Set cnn = CurrentProject.Connection
Dim strSQL As String
strSQL = "Select ID FROM [Computer Inventory] " _
& "WHERE [PC Name] = '" & Me.cboComputerName & "'"
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cnn...
The way I do it is as you have described.
I create an SQL statement and open it in an ADO recordset.
Then I loop thru each record something like this.
dim EmailAdd as string
do until rs.eof
EmailAdd = rs.fields("EmailAddress").value
Set myRequiredAttendee = .Recipients.Add(EmailAdd)...
Your code works for me.
me!lbxAddresses should be me!lbxAddresses.value to get the value.
Make sure you are seperating the email addresses with a ; and you are golden.
So ABC1 would be the lcus_code that you want? Just build a query off that table and get rid of that T or G and group the results. Base your join off of that query.
Mine sends to multiple people.
I loop thru a table that I have all the email addresses that I want to send to and do a outlookmessage.to =
for each record.