Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Access 97 to 2000 update woes


Message #1 by "Lloyd Levine" <levinll@m...> on Mon, 25 Mar 2002 20:46:07
I recently converted an Access 97 application to Access 2000 and 
unfortunately I'm experiencing some problems. Below is code that I use to 
send a report to a select set of users.

Set db = CurrentDb
SSql = "Select Distinct SMTPAddress from PendingExpenseVoucherQuery"
stDocName = "Pending Expense Vouchers"   ' Report to be used

Set rc = db.OpenRecordset(SSql)

Do While rc.EOF = False

    strSubject = "Pending Expense Vouchers"
    strMessage = "The attached Word document contains a list of pending 
expense vouchers that have not been formally submitted to a supervisor for 
approval"
  

    stFilter = "SMTPAddress = '" & rc![SMTPAddress] & "'"
    
    DoCmd.OpenReport stDocName, 
acViewPreview, "PendingExpenseVoucherQuery", stFilter
    
    
    If SendOutEmails() = True Then
        DoCmd.SendObject acSendReport, stDocName, acFormatRTF, rc!
[SMTPAddress], , , strSubject, strMessage, ShowEmails()
    End If
    
    DoCmd.SelectObject acReport, stDocName, False
    DoCmd.Close

    rc.MoveNext
Loop

rc.Close

What usually happens is the code goes through the first time fine and then 
the second time through the loop Access generates an error message stating 
that it can't find the report that I'm trying to email.

Any help in solving this problem would be greatly appreciated.

  Return to Index