C
Curtis Stevens
Got two forms & different tables. Customers & Affiliates
I'm trying to create an onclick event where when I'm in the Customers form,
I check this box saying this customer has been referred by this particular
affiliate (which there is another box with affiliate's ID & what is linking
that customer to that particular affiliate). When they do that, this code is
initiated to create an html email. My problem is the coding I have below,
the errors is "Me.ContactName" and "Me.Email", because it is suppose to grab
that information from the affiliate table/form for that particular affiliate
that referred that customer. But I'm not in the Affiliate's form & it isn't
open, which if I put that code somewhere on that form, it works just fine....
Any help?
Const olMailItem = 0
txtDir = "C:\USMS\Emails\"
Set objoapp = CreateObject("Outlook.Application")
Set objOMessage = objoapp.CreateItem(olMailItem)
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fspenTextFile(txtDir & "AffiliateReferral", 1)
txtbody = ts.ReadAll
txtbody = FindAndReplace(txtbody, "ContactName", Me.ContactName)
With objOMessage
.to = Me.Email
.Subject = "You Made a Referral!"
.htmlbody = txtbody
.Display
End With
I'm trying to create an onclick event where when I'm in the Customers form,
I check this box saying this customer has been referred by this particular
affiliate (which there is another box with affiliate's ID & what is linking
that customer to that particular affiliate). When they do that, this code is
initiated to create an html email. My problem is the coding I have below,
the errors is "Me.ContactName" and "Me.Email", because it is suppose to grab
that information from the affiliate table/form for that particular affiliate
that referred that customer. But I'm not in the Affiliate's form & it isn't
open, which if I put that code somewhere on that form, it works just fine....
Any help?
Const olMailItem = 0
txtDir = "C:\USMS\Emails\"
Set objoapp = CreateObject("Outlook.Application")
Set objOMessage = objoapp.CreateItem(olMailItem)
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fspenTextFile(txtDir & "AffiliateReferral", 1)
txtbody = ts.ReadAll
txtbody = FindAndReplace(txtbody, "ContactName", Me.ContactName)
With objOMessage
.to = Me.Email
.Subject = "You Made a Referral!"
.htmlbody = txtbody
.Display
End With