473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can I get all recordset results into email body

Hi Everybody,
I'm having trouble getting all recordset records into the body of an email. I just get one when there should be more. Could you please checkout my code to see where I'm going wrong. Thank you. Eddie...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.   Dim rs As dao.Recordset
  3.   Dim strSql As String
  4.  
  5. strSql = "SELECT tblRRCustomers.ArriveDate, tblRRCustomers.Property, [CustFirstName] & "" "" & [CustLastName] AS Name, tblRRCustomers.ArriveTime, tblRRCustomers.DepartDate, tblRRCustomers.DepartTime, tblRRCustomers.Adults, tblRRCustomers.Children, Format([ArriveDate],""dddd  mmm dd"") & "",  "" & Format([ArriveTime],""hh\.nn\.AM/PM"") & "" to "" & Format([DepartDate],""dddd mmm dd yyyy"") & "",  "" & Format([DepartTime],""hh\.nn\.AM/PM"") AS DateLine, tblRROwners.IDOwners, tblRROwners.OwnerFirstName, tblRROwners.OwnerLastName, [OwnerFirstName] & "" "" & [OwnerLastName] AS Owner " & vbCrLf & _
  6. "FROM tblRROwners INNER JOIN (tblRRProperty INNER JOIN tblRRCustomers ON tblRRProperty.Property = tblRRCustomers.Property) ON tblRROwners.IDOwners = tblRRProperty.IDOwners " & vbCrLf & _
  7. "WHERE (((tblRRCustomers.ArriveDate)>=Now()) AND ((tblRROwners.IDOwners)=10) AND ((tblRRCustomers.BookingStatus)=2 Or (tblRRCustomers.BookingStatus)=3)) " & vbCrLf & _
  8. "ORDER BY tblRRCustomers.ArriveDate, tblRRCustomers.Property;"
  9.  
  10.  Set rs = CurrentDb.OpenRecordset(strSql, dbOpenDynaset)
  11.  Do While Not rs.EOF
  12.  
  13.      strMSg = rs!DateLine & ", " & rs!Property & ", " & rs!Property & vbCrLf
  14.  
  15.  
  16.      rs.MoveNext
  17.      Loop
  18.  
  19. DoCmd.SendObject acSendNoObject, , , "heriage@oyster.net.ck", , , "Confirmation Test", strMSg, True
  20.  
  21. End Sub
Mar 27 '12 #1

✓ answered by NeoPa

I suspect your line #13 wants to say :
Expand|Select|Wrap|Line Numbers
  1. strMsg = strMsg & {some separator character} & rs!DateLine ...
It also appears clear that this code has never been compiled properly. Please see, and follow the instructions in, Before Posting (VBA or SQL) Code before next posting code.

3 1911
NeoPa
32,556 Expert Mod 16PB
I suspect your line #13 wants to say :
Expand|Select|Wrap|Line Numbers
  1. strMsg = strMsg & {some separator character} & rs!DateLine ...
It also appears clear that this code has never been compiled properly. Please see, and follow the instructions in, Before Posting (VBA or SQL) Code before next posting code.
Mar 27 '12 #2
Thank you so much Neo, that was the nail on the head,
Cheers Eddie
Mar 27 '12 #3
NeoPa
32,556 Expert Mod 16PB
Good to hear :-)
Mar 27 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dave | last post by:
Hi There Is there any how can we attach html page into email body by just encoding url ? something like with oMsg .From="blah blah blah" .To="abc@xyz.com" .body=www.mysite.com/default.htm...
6
by: mike | last post by:
I have created a side application in VB.NET which reads rows from a DB and builds an email message. when i have a long string the the mailmessage.body or the mailmessage, it puts in an...
16
by: TJO | last post by:
I am trying to pre populate an email body using javascript. I cannot figure out how to control the carraige returns for the text. The standard \r\n is not working. Is there another technique I...
2
by: Lee | last post by:
As the subject states, I have been playing in the system trying to figure out a method of using a report as the email body text. So far, the closest I have come is the acFormatHTML. However,...
0
by: DFS | last post by:
Access 2003, Outlook 2003. DoCmd.SendObject acSendNoObject, , , , , , subjectString, bodyString, True When the email opens, the email body is not populated (bodyString is a string variable)....
2
by: William Gower | last post by:
I am creating an email message to be sent from a web page. How do I embed variables like strFirstName, strLastName etc. into the body I would like it to say. Last Name : strLastName ...
0
by: RickVidallon | last post by:
Missing or Truncated Body Text in Email Application - 2 Strange Examples... There is no earthly reason why this is happening! EXAMPLES HERE: http://65.36.227.70/actmailer/ We have a...
1
by: salad | last post by:
I can store in a a hyperlink like this ClickMe#http://www.test.com in Access ClickMe is the display text, http://www.test.com the address. Is it possible, using SendObject, to send this...
2
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi, I am creating emails dynamically using C# and would like to place a hyperlink in the email body before sending it out. I added the text for what I thought was a hyperlink but the email just...
9
by: Aslam Shah | last post by:
I have a form with 150 checkboxes. Need to send email with the Checked ones usng ASP. But i am unable to figure a simple way to do it. All i can understand is getting their values one by one and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.