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
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