Solved

Sending EMAIL from Visual Basic Code

Posted on 2004-03-24
8
188 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 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