Email

The Biggest Sigh of Relief Ever!

Thanks SO much for all your help. Not only is it now done but I think I actually understand what's happening!
 
Good for you, now you can enjoy your w/end now that's off your mind;)
 
Oh god, that's just the first of MANY headaches I've yet to deal with on my little system!

No, I'm hell bent on finding a decent course - gonna ask everyone's advice in a new thread....
 
Hay! Thanks a million... and everyone else i have learned so much by looking at what you have done, still working out how some of the code works but it looks good.
 
is there anyway i can change the code in the button in bucks form

from
EmailSend.To = "email@somewhere.com"

to
EmailSend.To = (the field in the subform on frmSelect2Email then loop through them all... not getting asked to send every time OR putting the same field in the bcc section with a ; inbetween????)

Hay does the type search form work at your end??? i can select the type but when i click on the search button nothing happens? the qryDynamic_QBF has the criteria set to typeID 2 which i thought would mean only that type would be in the subform? i have fixed( or suposed to have) this computer at home so it could be my computer so if it works at you can you let me know.
 
would
EmailSend.Bcc = forms!frmSelect2Email!tblContacts_subform1!Type + ";"

work for sending the message??? no??
 
I think this is what you want to do, assuming you don't need to loop through a list of email that is.

Add this to the top of the code:

Code:
Dim strEmail As String
strEmail = Me.txtEmail ' txtbox that holds the email address

' ..........Some Code Here..........................
' ..........Some Code Here..........................

EmailSend.To = strEmail

' ..........Some Code Here..........................
' ..........Some Code Here..........................

Since you are using a subform the syntax is going to be slightly different. I don't have a second to test it out so if you don't get it just post back and I will take another look later.
 
Lyns, QBF all working well for me. I use 2000 at work and XP at home so it's running correctly in both. Am I correct in saying you now want to loop through the recordset and send the attachment along with a message typed in your form and send these without opening outlook as opposed to your original idea of selecting the contacts and opening outlook with the attachment adding all selected contacts to the bcc section?

If you want to go with option one I'm not sure how you attach the document as well as loop through the recordset at the same time...never tried that, would be quite interested in knowing though - Perhaps Bukhix will come up with a solution. I will have a go at it myself but I'm not promising anything (I know you're in a hurry for this too) unfortuantely I'm in an all day meeting tomorrow..won't that be fun:rolleyes: so it might be quite late on in the day before I can have a go at this.....doesn't work properly here at home either as I don't use outlook.

Hay
 
Hayley Baxter said:
I'm in an all day meeting tomorrow...


should have read:


I'm in an all day talking shop tomorrow... ;) :rolleyes:
 
managed to escape for lunch...more like falling asleep Mile - bored out my skull:( Not to worry only another 3 hours or so to go:rolleyes:
 
Well, all that matters kicks off tomorrow...;)
 
Yes indeed so which side will you be rooting for tomorrow then? I know you'll be following the 'real' blues tomorrow and the other blues in every other game;)
 
lynsey2 said:
would
EmailSend.Bcc = forms!frmSelect2Email!tblContacts_subform1!Type + ";"

work for sending the message??? no??

Are you guys still having issues with email? This thread seems to be open everytime I come into the forum.

If your email addresses can be resolved you do not need to append the ';'. That is in your form you can do:
jblow;jdoe;mhopkins

And if these names can be resolved (on exchange server or what not) than you dont need to have the @blah.com or the ';'. Provided that you have entered the ;.

Same works for BCC and CC.

Jon
 
this is looking good! been working on it over the weekend and there is one bit i cant get.. i have used all the different ways and mixed them together and stuff but im stuck again...last problem :rolleyes: :p hopefuly

what i have done is set up a list box based on the same qry that my subform is. i have only passes the email addresses from the qry into the listbox. it shows the same as whats in the subform.

this is buck's code that im using with the wee changes

Private Sub Email_Click()
Dim strFilter As String
Dim strInputFileName As String
Dim straddressTXT as String

strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

Dim EmailApp, NameSpace, EmailSend As Object

Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)

EmailSend.Bcc = straddressTXT
EmailSend.Subject = "Advert"
EmailSend.Body = Forms!frmSelect2Email!EmailTXT
EmailSend.Attachments.Add strInputFileName
EmailSend.Display

Set EmailApp = Nothing
Set NameSpace = Nothing
Set EmailSend = Nothing

End Sub

any clues why its not taking the email addresses from the list box?
 
Where are you assigning the email?
Where are you sending the email?
Email.Display just shows the email..it does not send it.

You CANNOT send the listbox control name to the BCC field.
YOu have to loop through that list box for each row...a listbox is retrieves data from your query..so its mimicing a table or a query by rows...you need a FOR each loop that takes the email and moves to the next index in the list box.

Jon
 
Where are you assigning the email?

??? dont know what you mean??? sorry :o

Where are you sending the email?

I am sending the email to some contacts. e.g. 200 construction contacts.

Email.Display just shows the email..it does not send it.

Thats actually OK with me as it gives them a chance to check over the email before its sent and then they can click on send in outlook
 
:mad: :mad: :mad: :mad: how frustrating is this:mad: :mad: :mad: :mad:

still cant get it to work.
 
Private Sub Email_Click()
Dim rsEmail As DAO.Recordset
Dim strFilter As String
Dim strInputFileName As String
Dim strEmail As String

strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

Dim EmailApp, NameSpace, EmailSend As Object

Set rsEmail = CurrentDb.OpenRecordset("qryDynamic_QBF")
Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.getNameSpace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)


Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("Email").Value
EmailSend.Bcc = strEmail
rsEmail.MoveNext
Loop
EmailSend.Subject = "Advert"
EmailSend.Body = Forms!frmSelect2Email!EmailTXT
EmailSend.Attachments.Add strInputFileName
EmailSend.Display

Set rsEmail = Nothing
Set EmailApp = Nothing
Set NameSpace = Nothing
Set EmailSend = Nothing

End Sub
 
I am still working on this but I am totaly shattered now so think i'll head to bed!

the code i have posted above works to some extent...

it does the attachment and all but it doesnt pass over all of the email addresses.... just the last one

I have done the tryal and error thing by putting the loop bit in different places an managed to get it to add the attachment 3 times but still just the one last email. This code is back to last address in the list box and one attachment.

I'm begging now for some more help on this last wee bit.:( :( :(
all i need now is for it to pass over not just the last email address in the list box but ALL of them:(

Night night for now!
 

Attachments

Users who are viewing this thread

Back
Top Bottom