Solved

Sending EMAIL from Visual Basic Code

Posted on 2004-03-24
8
183 Views
Last Modified: 2013-11-25
Hi,
  I want to send an email to the user directly form my vb form by pressing a button.

Secondly i am using a datagrid with adodc1 to retrieve some records from the patient table. However i want only to retrieve records for a sinlge patient by pressing a serach button and only a particular patient records should be displayed on the grid but currently i am getting all patients the records being retrieved from the table. I have used select query at design mode and all setting are made in the design mode. I have tried to put the adodc1 and datagrid code and the query behind the search button but then i get errors.

For example if i say

datagrid1.recordsource=adodc1  <--- it gives an error.

Anyone have any ideas
0
Comment
Question by:rockzZ101
  • 2
  • 2
8 Comments
 
LVL 1

Accepted Solution

by:
shendr8086 earned 20 total points
ID: 10670602
For the email you will need to put a MAPI control on yur form or include a reference to Outlook and use the Outllook object. THe MSDN site can help you with this.
0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 10671778
Hi,
here is a nice and simple tutorail on how to send email using VB.

http://www.devarticles.com/c/a/Visual-Basic/Sending-Email-With-MAPI-Components-in-Visual-Basic/
0
 
LVL 1

Expert Comment

by:shendr8086
ID: 10671926
You can use this once you set a reference to Outlook in the IDE:

    Set olApp = CreateObject("Outlook.Application")
    Set olns = olApp.GetNamespace("MAPI")
    Set olMail = olApp.CreateItem(olMailItem)
    olns.Logon
    olMail.To = Address
    olMail.Subject = Subject
    olMail.Body = Body
    olMail.Send
    olns.Logoff
   
    Set olns = Nothing
    Set olMail = Nothing
    Set olApp = Nothing
0
 

Expert Comment

by:maxmai
ID: 10676397
Hi,
you can use JMail component. It's free and very easy to use.

Can be downloaded from

http://www.dimac.net/FreeDownloads/dlstart.asp?ProductID=5

0
 
LVL 15

Expert Comment

by:unknown_routine
ID: 11258012
rockzZ101: has recieved complte answer to 1st part of his question.

A split and with grade B or C seems proper.

Regards.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now