Results 1 to 7 of 7
  1. #1
    superstefpula is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    6

    Talking I am mad realy mad

    it is almost 4 days thath I am trying to find solution to the problem.
    Please somebody help me because I am losing my mind.
    maybe in this forum there is a solution but I have not found it.

    I have created a form (using wizard) from the table (tblosn) with the names of people who live in different cities all of them also had a email, phone number and so on.



    while I am using a form the people can easily be filtered by city using right click on my mouse and select "equal amsterdam" or other city.

    I want to make a button on this form which must open outlook and put in Bcc all filtered emails from this form. if I chose for example all the people which name start with "A" the button must open outlook and put in Bcc all the e mail adres of those people.

    after thath I will write a message in the body of open outlook


    For now I have a "solution" that allows me to open outlook and put all emails in Bcc from table not form by pressing the button irrelevant to the filter I made but I do not need this..

    pleas, pleas, pleas...

  2. #2
    superstefpula is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    6
    this is how my cod looks like now and I do non need it but it do what I have previously written

    Private Sub Command69_Click()
    Dim strEMail As String
    Dim oOutlook As Object
    Dim oMail As Object
    Dim strAddr As String
    Dim MyDB As DAO.Database
    Dim rstEMail As DAO.Recordset

    Set oOutlook = CreateObject("Outlook.Application")
    Set oMail = oOutlook.CreateItem(0)

    'Retrieve all E-Mail Addressess in tblEMailAddress
    Set MyDB = CurrentDb
    Set rstEMail = MyDB.OpenRecordset("Select * From tblosnova", dbOpenSnapshot, dbOpenForwardOnly)

    With rstEMail
    Do While Not .EOF
    'Build the Recipients String
    strEMail = strEMail & ![EMail] & ";"
    .MoveNext
    Loop
    End With
    '--------------------------------------------------

    With oMail
    .BCC = Left$(strEMail, Len(strEMail) - 1) 'Remove Trailing ;
    .Body = "sadržaj skupnog maila"
    .Subject = "IRTA"
    .Display
    End With

    Set oMail = Nothing
    Set oOutlook = Nothing

    rstEMail.Close
    Set rstEMail = Nothing
    End Sub

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Instead of creating your own Recordset, use the RecordsetClone of the Form which will be filtered as you wish.

  4. #4
    superstefpula is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    6
    OK, but how ?
    I have no idea about makeing this change in my cod. please can you write this for me?

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Try replacing this line:
    Set rstEMail = MyDB.OpenRecordset("Select * From tblosnova", dbOpenSnapshot, dbOpenForwardOnly)

    With:
    Set rstEMail = Me.RecordsetClone
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    superstefpula is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    6
    I love you guys... This is a solution to my problem.
    everything works perfectly.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Thanks for posting back with your success.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums