list all records not just first

tubar

Registered User.
Local time
Yesterday, 19:00
Joined
Jul 13, 2006
Messages
190
Code:
DoCmd.SendObject acSendReport, "tblbuildHD", acFormatPDF, "m.s@minpm.gov ; edith.ga@minsmn.gov", , , "MCC PAYROLL BY HAND", "Here is this weeks payroll sorted by HAND. This PDF is an attachment and is also located in your dropbox/payroll by name/end of payroll FINAL VERSION" & Me.edith
the following code generates an email. in the message of the email im trying to input notes from a query. the notes are located in me.edith. everything works except there are three records in the query and only the first is listed in the email message... also this code is generated when a form opens...is there a form option i could change to include all records in the message of the email?
 
Hi,

The problem is you are only looking at the first record so you will need to do something in vba along the following lines. Then substitute TblErrStr for
Me.edithErrHandler:

Function TblErrStr() as String
Dim Mydb as Database
Dim Rst as Recordset

Set Mydb=Currentdb
Set Rst=Mydb.openrecordset ("Select Edith From tblBuildHD Where Edith is not Null")
TblErrStr=""
While not rst.eof
errstr=errstr & ", "
Wend
set rst=nothing
set mydb=nothing
end Function
 
if you wanted each note to appear on a new line then you can force line breaks by adding VbCrLf to CJ's suggestion
errstr=errstr & ", " & VbCrLf

David
 

Users who are viewing this thread

Back
Top Bottom