473,386 Members | 1,598 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,386 software developers and data experts.

Sending e-mail with variables from a table

I'm using access to read in data from several fields and send an e-mail. I can capture one of the fields in the file into a variable (full_link), but not the others. Whenever it hits the variable assignment line for the other fields, I get a "Method or Data Member not found" error. If I hard-code the other fields but still have the strFullLink variable, it works fine. What am I missing?

Private Sub Command0_Click()
Dim strToWhom As String
Dim strSubject As String
Dim strBody As String
Dim strMsgBody As String
Dim intSeeOutlook As Integer
Dim strFullLink As String

DoCmd.OpenTable "table_email"

strFullLink = Me.full_link
strToWhom = Me.mail_add
strSubject = Me.mail_sub
'strToWhom = InputBox("Enter recipient's e-mail address.")
'strSubject = InputBox("Enter Subject.")
strBody = "Your package has been sent. It may be tracked with the following link: " + strFullLink

DoCmd.SendObject , , , strToWhom, , , strSubject, strBody, intSeeOutlook
x = MsgBox("Email has been sent")

End Sub
Aug 15 '07 #1
3 2614
Okay, solved that one. All I had to do was remove the data source (which did not have those fields when I linked it to the table) and re-add it.
Aug 15 '07 #2
Okay, new problem. I'm looping through the table to grab information and send an e-mail to each. However, the variables are not being re-set. The e-mail is being sent each time, but it's all the information from the first record. I know it's getting all the way through the loop, so why are the variables not reset to the next record's value?

Private Sub Command0_Click()
Dim intCounter As Integer
Dim strToWhom As String
Dim strSubject As String
Dim strBody As String
Dim strMsgBody As String
Dim intSeeOutlook As Integer
Dim strFullLink As String

DoCmd.OpenTable "table_email"
intCounter = 0

Do While intCounter < 10

strFullLink = Me.full_link
strToWhom = Me.mail_add
strSubject = Me.mail_sub
'strToWhom = InputBox("Enter recipient's e-mail address.")
'strSubject = InputBox("Enter Subject.")
strBody = "Your package has been sent. It may be tracked with the following link: " + strFullLink

DoCmd.SendObject , , , strToWhom, , , strSubject, strBody, intSeeOutlook
'x = MsgBox("Email has been sent")
DoCmd.GoToRecord , , acNext
intCounter = intCounter + 1
Loop

End Sub
Aug 15 '07 #3
FishVal
2,653 Expert 2GB
Okay, new problem. I'm looping through the table to grab information and send an e-mail to each. However, the variables are not being re-set. The e-mail is being sent each time, but it's all the information from the first record. I know it's getting all the way through the loop, so why are the variables not reset to the next record's value?

Private Sub Command0_Click()
Dim intCounter As Integer
Dim strToWhom As String
Dim strSubject As String
Dim strBody As String
Dim strMsgBody As String
Dim intSeeOutlook As Integer
Dim strFullLink As String

DoCmd.OpenTable "table_email"
intCounter = 0

Do While intCounter < 10

strFullLink = Me.full_link
strToWhom = Me.mail_add
strSubject = Me.mail_sub
'strToWhom = InputBox("Enter recipient's e-mail address.")
'strSubject = InputBox("Enter Subject.")
strBody = "Your package has been sent. It may be tracked with the following link: " + strFullLink

DoCmd.SendObject , , , strToWhom, , , strSubject, strBody, intSeeOutlook
'x = MsgBox("Email has been sent")
DoCmd.GoToRecord , , acNext
intCounter = intCounter + 1
Loop

End Sub
Hi, there.
Pay attention to your code.
Your open a table
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenTable "table_email"
and loop through its records
Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToRecord , , acNext
but gather data from a form where CommandButton is located.
Expand|Select|Wrap|Line Numbers
  1.     strFullLink = Me.full_link
  2.     strToWhom = Me.mail_add
  3.     strSubject = Me.mail_sub
  4.  
Aug 16 '07 #4

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

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt....
1
by: coder_1024 | last post by:
I'm trying to send a packet of binary data to a UDP server. If I send a text string, it works fine. If I attempt to send binary data, it sends a UDP packet with 0 bytes of data (just the...
3
by: Robert A. van Ginkel | last post by:
Hello Fellow Developer, I use the System.Net.Sockets to send/receive data (no tcpclient/tcplistener), I made a receivethread in my wrapper, the receivethread loops/sleeps while waiting for data...
4
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
3
by: Sydney | last post by:
Hi, I am trying to construct a WSE 2.0 security SOAP request in VBScript on an HTML page to send off to a webservice. I think I've almost got it but I'm having an issue generating the nonce...
3
by: Sells, Fred | last post by:
I'm using MSW XP Pro with Python 2.4 to develop but production will be Linux with Python 2.3. (could upgrade to 2.4 if absolutely necessary) I can also switch to Linux for development if...
9
by: Miro | last post by:
VB 2003 at the end of the code, this works great. bytCommand = Encoding.ASCII.GetBytes("testing hello send text") udpClient.Send(bytCommand, bytCommand.Length) and this recieves it Dim...
0
by: remya1000 | last post by:
by using FTP i can send files to server using vb.net. if the file is big, then it will take some time to complete the sending process to server.or if we were sending 3-4 files to the server one by...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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...
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
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...

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.