Fast help needed for Access2k/Outlook2k Code.

Misty

Registered User.
Local time
Today, 11:01
Joined
Nov 12, 2003
Messages
45
[Permissions List for Work Orders].[EmpID] is where I have the email addresses for everyone I need to include in a Bcc address block.

The table name is [Permissions List for Work Orders], and the field name is [EmpID]. The data in the field is text and looks like one of two types:

Doe, John

or

Jane.doe@place.com


Either of these name formats will work, so all I need to do is get them from the table to the email in the Bcc block with a semi-colon and a space between each of them like this:

Doe, John; Jane.doe@place.com; Next, One; etc.

The only email code I've found is so far over my head that it looks like an Alien language to me.

I have to send everyone in this table an email that will have a new web address for our work order generation. As usual, the boss wants it yesterday and I can't find anything in my books that would make this happen.

Can someone pull my rear-end out of the fire again?

Thanks in advance to all of you,

M

Also, if you know of a book that I could learn this type of code from, please tell me the name.
 
Code:
Sub out_example()



'outlook stuff##########
Dim myoutlook As Outlook.Application
Dim mymsg
'message contents#######
Dim myto As String
Dim mysubj As String
Dim mybody As String
Dim mybcc As String

'create outlook
Set myoutlook = CreateObject("Outlook.Application")
Set mymsg = myoutlook.CreateItem(olMailItem)

'populate msg vars
'here you would use a function to retrieve your proper values
myto = "whatever@whatever.com"
mysubj = "kjkjjhjkkjhjk"
mybody = "lkjkljkljkljklj"
mybcc = "whatever@whatever.com;hgh@whatever.com;oiioyjug@whatever.com"



With mymsg
.To = myto
.Subject = mysubj
.Body = mybody
.BCC = mybcc
'use one of either .display or .send
.Display
'.Send
End With

Set myoutlook = Nothing
Set mymsg = Nothing

End Sub
 
I can see how the different parts of the code work, but I don't understand how to parse the [EmpID] from the table to the Bcc box.

'populate msg vars
'here you would use a function to retrieve your proper values
myto = "whatever@whatever.com"
mysubj = "kjkjjhjkkjhjk"
mybody = "lkjkljkljkljklj"
' ***************************
'How can the following code line bring the field information, [EMP], from the table, [Permissions List for Work Orders]?
mybcc= "whatever@whatever.com;hgh@whatever.com

****************************
 
Do you know how to retrieve records using ADO or DAO? If not do a search on here as I expect there will be numerous examples. When you’ve got your head round that, create a function that returns a string (in this case the bcc list) and use ADO or DAO to build said string from your table. Then simply point the mybcc at your new shiny function!!

mybcc = get_bcc_function()
 
Sorry to bother you.

As I said in my first post, my boss wants it yesterday. Learning how to retrieve the records and creating a function takes time. Time I don't have. I asked for help and got someone who wants to teach me. That would be great if I hadn't said it was time critical.

I'll use a different forum. Get your head round that shiny idea!

:mad:



bretto said:
Do you know how to retrieve records using ADO or DAO? If not do a search on here as I expect there will be numerous examples. When you’ve got your head round that, create a function that returns a string (in this case the bcc list) and use ADO or DAO to build said string from your table. Then simply point the mybcc at your new shiny function!!

mybcc = get_bcc_function()
 
Given the price of admission, I think Bretto was positively magnanimous. Good posts, Bretto.

Regards,
Tim
 

Users who are viewing this thread

Back
Top Bottom