Hi Guy's, I have used the the following code so I can find part of a mobile number, then on each line where i have "Send Email / rs.Fields("Email") / Click Here
When i hover over the link, the correct email displays on the tag from hovering but it wont generate and email ?
Do i need to add code for a new email within the HRef const Q ?
Code:
Private Sub txtMobile_DblClick(Cancel As Integer)Const Q = """"
Dim myItem As Outlook.MailItem
Dim OutAccount As Outlook.Account
Dim myApp As New Outlook.Application
Dim BoxStart As String, BoxEnd As String, FontStart As String, FontEnd As String, rsBody As String, rsEmail As String, strMail As String
Dim strA As String, strB As String, strC As String, strD As String, strE As String, strF As String, strG As String, strH As String, strI As String, SigFile As String
Dim strOpt As String
Dim rs As DAO.Recordset
Dim iOpt As Integer
BoxStart = "<table style='text-align:left;border:3px solid black;font-family:calibri;border-collapse:collapse;padding:25px'><tr style='background:white;mso-highlight:blue'>"
BoxEnd = "</tr></table>"
FontStart = "<font size='3'>"
FontEnd = "</font>"
strButton = "<tr><td><button class='editbtn'>edit</button></td></tr>"
strOpt = InputBox("Enter Any Part Of The Mobile Number To Search ?" & vbNewLine & vbNewLine & _
"ie: You Have Double Clicked On " & Me.Mobile & vbNewLine & vbNewLine & _
"You Can Type In For Example: 327", "ENTER NUMBERS")
Set rs = CurrentDb.OpenRecordset("Select * From tblRemovals WHERE Mobile Like ""*" & strOpt & "*""")
Do Until rs.EOF
rsBody = rsBody & rs.Fields("Client") & " " & rs.Fields("Town") & " " & rs.Fields("PostCode") & " " & rs.Fields("LiftMake") & " " & _
rs.Fields("LiftModel") & " " & rs.Fields("Tel") & " " & "<B>" & rs.Fields("Mobile") & "</B>" & "|" & _
"  " & "<span style='background:yellow'>" & rs.Fields("RecordNo") & "</span>" & " " & _
Format(rs.Fields("RemovalDate"), "ddd-dd-mmm-yyyy") & "  Send Email:  <a href=" & Q & rs.Fields("Email") & Q & ">" & "Click Here" & "</a>" & "|"
rs.MoveNext
Loop
strA = rs.RecordCount & " Mobile Numbers Found Containing<span style='background:yellow'>" & " " & strOpt & "</span>"
rsEmail = Me.EMail
Set myItem = myApp.CreateItem(olMailItem)
Set OutAccount = myApp.Session.Accounts.Item(2)
With myItem
.Subject = "Mobile Numbers Found"
.To = ""
.HTMLBody = strA & "<br>" & "<br>" & BoxStart & "<br>" & Replace(rsBody, "|", "<br>" & "<br>")
.SendUsingAccount = OutAccount
.Display
End With
Set myApp = Nothing
Set myItem = Nothing
Click Here does nothing even though the email appears on hover tag