Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    52

    Unanswered: Access ----> Outlook

    Hi, i'm attempting to write vb script to send one email to a list of people pulled off of a query. I'm almost there(I wouldn't be here without the help of you guys in here).


    I have a question, I keep on recieveing the error: recordset not updatable.

    At the line:

    Email = MyRS.Fields(0) & ";" & Email

    Its not my attention to write into this field?

    What gives???



    Private Sub Command14_Click()

    Dim MyDb As Database
    Dim MyRS As Recordset
    Dim strSQL As String
    Dim Address As String




    strSQL = "SELECT * FROM qryAttendance WHERE [type of conference]='" & basConference() & "' and [Times Attended]>=" & basAttendance() & ";"

    Debug.Print strSQL

    Set MyDb = CurrentDb
    Set MyRS = MyDb.OpenRecordset(strSQL)

    MyRS.MoveFirst



    Do Until MyRS.EOF
    Email = MyRS.Fields(0) & ";" & Email
    MyRS.MoveNext
    Loop

    Email = Left(Email, Len(Email) - 1)

    Set MyolApp = CreateObject("Outlook.Application")
    Set MyItem = MyolApp.CreateItem(olMailItem)
    Set MyRecipient = MyItem.Recipients.add(Email)

    MyItem.Subject = "Your Title"

    Msg = Chr(13) & "Hi," & Chr(13) & Chr(13)

    MyItem.Body = "This is a test" & Chr(13) & Chr(13) & "Thanks"
    MyItem.Display

    MyRS.Close

    End Sub

  2. #2
    Join Date
    Feb 2004
    Location
    Dorset UK
    Posts
    147
    I used these and it worked:


    Dim MyRS As New ADODB.Recordset


    MyRS.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic


    I left all your other code alone though..

    Does that work ?

    Ken

    PS Have a good weekend !

  3. #3
    Join Date
    Mar 2004
    Posts
    52
    Ken,


    my mistake, for some reason I assumed the code 'email' was referenceing emails in the query. When I realized that the eamil_who was building a string of email(s) then it made sense.Code works. Thanks abunch!!


    Originally posted by Ken_Hart
    I used these and it worked:


    Dim MyRS As New ADODB.Recordset


    MyRS.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic


    I left all your other code alone though..

    Does that work ?

    Ken

    PS Have a good weekend !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •