Solved

Sending EMAIL from Visual Basic Code

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

743 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

12 Experts available now in Live!

Get 1:1 Help Now