Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User-Define Object not defined

Status
Not open for further replies.

raa44634

Technical User
Dec 13, 2001
34
0
0
US
I'll first admit that I'm not literate at code writing. I've found an older database where the following code worked and I copied and updated it to meet my needs. However, I continue to get the error "user-defined object not defined" for
Dim dbs As Database

My entire code is below. Any help and insight is very much appreciated by this novice!



Option Compare Database
Option Explicit

Private Sub cmdEmail_Click()

Dim rst As Recordset
Dim dbs As Database
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tbl_Email", dbOpenForwardOnly)

Do Until rst.EOF = True

DoCmd.SendObject acSendReport, rst!RptName, rst!Output, rst!EmailName, , , , , False
DoCmd.Close

rst.MoveNext
Loop

rst.Close
dbs.Close
Set rst = Nothing
Set dbs = Nothing

End Sub
 
Hi raa44634,

Try ..

Code:
Dim dbs As
Code:
DAO.
Code:
Database

.. and also ..

Code:
Dim rst As
Code:
DAO.
Code:
Recordset

Enjoy,
Tony

------------------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading FAQ222-2244 before you ask a question.
 
Tony,

Thanks for the immediate feedback! Your suggestions couple with information I found in thread 68-566499 (ensuring the latest Microsoft DAO library is active and has a high priority) my code Finally works!

Thanks so much!

- Tony -
(Yes, my name is Tony, too)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top