Data connections (1 Viewer)

seany

Registered User.
Local time
Today, 20:40
Joined
Sep 1, 2003
Messages
53
Can someone please time me want is wrong with is code. I am trying to send a email for each person in a table called Tbl_Uses. I am new to using data connections so is there something basic at the start which is need to do?


Function email()

Dim Report As String
Dim emailaddress As String
Dim sql As String
Dim rs As Recordset

Report = "Rpt_Email_PassTo"


Set rs = CurrentDb.OpenRecordset("Tbl_Users", dbOpenSnapshot)
If Not rs.BOF Then
rs.MoveFirst

Do Until rs.EOF
emailaddress = rs("email")
DoCmd.SendObject acSendReport, Report, acFormatRTF, email, , , "Planning Application register", "", "No"
rs.MoveNext

Loop
End If
rs.Close

End Function
 

Mile-O

Back once again...
Local time
Today, 20:40
Joined
Dec 10, 2002
Messages
11,316
What version of Access are you using?
 

seany

Registered User.
Local time
Today, 20:40
Joined
Sep 1, 2003
Messages
53
I am using 2000. I have changed the dbOpenSnapshot to DB_OPEN_TABLE. And is error with data missmatch.
 

seany

Registered User.
Local time
Today, 20:40
Joined
Sep 1, 2003
Messages
53
I can understand how this has something to do with my problem. Can you please give me some more guide ness please. Can't understand why my code is not working.
 

Mile-O

Back once again...
Local time
Today, 20:40
Joined
Dec 10, 2002
Messages
11,316
What more do you need? :confused:

That whole article lists the problem, why it happens, and how to resolve it.
 

seany

Registered User.
Local time
Today, 20:40
Joined
Sep 1, 2003
Messages
53
Hi,

All I need to do was turn Mircosoft DAO reference on.

Thanks
 

Users who are viewing this thread

Top Bottom