- Public Sub EmailTemplates()
-
Dim db As DAO.Database
-
Dim rs As DAO.Recordset
-
Dim MailRecipents As String
-
Dim MailRecipents1 As String
-
Dim MailRecipents2 As String
-
Dim objOutlook
-
Dim objEmail
-
Dim BodyEmail As String
-
Dim Department As String
-
Dim SubjectLine As String
-
Dim Frm As New Access.Form
-
BodyEmail = " Kindly find the attachment for GL Numbers.Fill in the balance and please dont change any thing other than Balances "
-
DoCmd.SetWarnings False
-
DoCmd.OpenForm "Form3"
-
Set db = CurrentDb
-
Set rst = db.OpenRecordset("email_final")
-
Set rs = db.OpenRecordset("email_final", dbOpenDynaset)
-
Set Frm = Forms("Form3")
-
With rs
-
-
-
Do Until .EOF
-
Department = rs.Fields("DeptID")
-
-
-
SubjectLine = " General Ledger template "
-
Forms!Form3!DeptID = rs.Fields("DeptID")
-
MailRecipents = rs.Fields("address1")
-
MailRecipents1 = rs.Fields("address2")
-
MailRecipents2 = rs.Fields("address3")
-
Debug.Print MailRecipents
-
Debug.Print MailRecipents1
-
Debug.Print MailRecipents2
-
-
-
If Department <> rs.Fields("DeptID") Then
-
DoCmd.SendObject acSendQuery, "testTemplate", acFormatXLS, MailRecipents, MailRecipents1, MailRecipents2, SubjectLine, BodyEmail, False
-
Else
-
DoCmd.SendObject acSendQuery, "testTemplate", acFormatXLS, MailRecipents, MailRecipents1, , SubjectLine, BodyEmail, False
-
End If
-
-
rs.MoveNext
-
-
-
Loop
-
End With
-
rst.Close
-
Set rst = Nothing
-
-
Set rs = Nothing
-
Set db = Nothing
-
DoCmd.SetWarnings True
-
-
End Sub
Have used the testTemplate query = SELECT DISTINCT (tblGLNumbersNew.AcctNo), tblGLNumbersNew.[Account Name], tblGLNumbersNew.DeptIDRef, tblGLNumbersNew.[Account Type], date() AS EOM, CCur(0) AS [0-30 Days Amount], CInt(0) AS [0-30 Days Items], CCur(0) AS [31-60 Days Amount], CInt(0) AS [31-60 Days Items], CCur(0) AS [61-90 Days Amount], CInt(0) AS [61-90 Days Items], CCur(0) AS [Over 90 Days Amount], CInt(0) AS [Over 90 Days Items], CCur(0) AS [Total Amount], CInt(0) AS [Total Items]
FROM emailaddress INNER JOIN tblGLNumbersNew ON emailaddress.DeptID=tblGLNumbersNew.DeptIDRef
WHERE (((tblGLNumbersNew.DeptIDRef)=Forms!Form3!DeptID))
ORDER BY tblGLNumbersNew.DeptIDRef;
1 1177
Hi. It is not easy to read a bunch of code without an explanation about what it does and what you've already tried in debugging the error. I've added code tags around the VBA segment to make it easier to read your code, and to refer to individual lines within it.
Since your error is occurring at line 28 above, and not at line 24 which is the first reference to field DeptID, it suggests that either there is no control named DeptID on Form3, or that Form3 is non-updatable (or bound to a data source which is non-updatable).
-Stewart
Sign in to post your reply or Sign up for a free account.
Similar topics
by: IMS.Rushikesh |
last post by:
Hi Friends,
My work is stuck up because of this unresolvable and unbelievable
Error.
I'm trying to Serialize my Class object using XmlSerialization. And at
below line, I m getting "error File...
|
by: Rod |
last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some
reason, opening some ASP.NET applications we wrote is producing the
following error message:
"The Web server reported...
|
by: AMD Desktop |
last post by:
Hi,
I need to add a header to a datagrid.
This is the code I am trying to use:
Dim dgStaffingReport As New DataGrid
Dim dgitem As New DataGridItem(0, 0, ListItemType.Header)
Dim mycell...
|
by: Al |
last post by:
Hi,
I am seeking to obtain the line number of an error once
deployed with out inserting line numbers in the method.
The IDE inserts line numbers but this function does not
appear to be a...
|
by: Rotsey |
last post by:
Hi,
I am trying to write some error handling code to log the error.
But getting the line number of the error is not simple.
Is it because the app is set to "Release" and does not have debug...
|
by: Rod |
last post by:
I've recently upgraded to Crystal Reports 11 Release 2 on my development
machine. Right now I'm trying to get one of our ASP.NET 1.1 applications
working with it. Several pages already work with...
|
by: ipy2006 |
last post by:
In my HTML I have,
<input type="button" class="cartonsumkey" value="Sum Cartons"
onclick="sumup(this);" />
In an external file that is called in Head area, I have,
function sumup( o ) {
...
|
by: Archana |
last post by:
Hi all,
I am having application where i am downloading xml content using
webrequest. my code is as below
HttpWebRequest lWebRequest = (HttpWebRequest) WebRequest.Create(URL);
HttpWebResponse...
|
by: vikas251074 |
last post by:
I am getting error while entry in userid field. When user enter his user id, an event is fired immediately and user id is verified using AJAX method. But I am getting error 'Object doesn't support...
|
by: Omendra |
last post by:
Hi, I am using SQL Server 2005 and i am using Stored Procedure something like :-
I am getting error:-
Msg 170, Level 15, State 1,
Line 18: Incorrect syntax near 'MAX'.
DECLARE @jid AS...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |