Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Forum översikt / inlägg

Posta nytt inlägg


Mail från access

Postades av 2005-04-05 13:00:52 - Fredrik Johansson, i forum access, Tråden har 9 Kommentarer och lästs av 1023 personer

Är det möjligt att genom en knappklickning i ett accessformulär automatiskt skicka ett email?

Detta email skall skapas utifrån ett formulär i access med all information som det för tillfället visar.


Svara

Sv: Mail från access

Postades av 2005-04-05 21:34:38 - Pelle Johansson

<code>
' Automating Outlook
' NOTE: A referece to the installed Outlook library must be
' made under TOOLS | REFERENCES (in VBA) or PROJECT | REFERENCES in (VB)
' *************************************************************************

Sub SendMail() ' NOTE: This routine will work will all incarnations of VBA
Dim myOutlook As Object
Dim myMailItem As Object
' Make instance
Set myOutlook = CreateObject("Outlook.Application")
' Make mail item
Set myMailItem = myOutlook.createitem(0)
' Set recipient (internal mail)
myMailItem.Recipients.Add "Doe, John"
' Set recipient (external mail)
myMailItem.Recipients.Add "JDoe@Yahoo.com"
' Set subject
myMailItem.Subject = "test"
' Set body
myMailItem.body = "Quick test!"
' And send it!
myMailItem.send
' Close instance
Set myOutlook = Nothing
End Sub

</code>


Svara

Sv:Mail från access

Postades av 2005-04-06 12:15:10 - Fredrik Johansson

Superbra, tack så väldigt mycket Pelle!

Men...hur kommer det sig att outlook slutar fungera efteråt? Ibland...inte alltid, man måste starta om datorn för att dra igång outlook igen. :-/

Vet du om det går att komma runt säkerhetsfunktionen i outlook som frågoar om man ska tillåta att mailet skickas? Har letat i alla inställningar jag kan hitta men hittar inget om just detta när externa program försöker skicka.


Svara

Sv: Mail från access

Postades av 2005-04-07 10:29:22 - Göran Lindstedt

För att kunna ta bort tjôtet om säkerhet i outlook måste man för det första köra exchange server.
Sedan måste man skapa en mapp under gemensamma mappar som heter Outlook Security Settings och i den posta ett formulär, Outlook Security forms som finns att hämta på microsoft. I detta formulär kan man bestämma annurlunda säkerhet för enskillda personer eller hela grupper.

Till sist måste man göra ett registerhack på clienten genom att lägga in följande nyckel

HKEY_CURRENT_USER\Software\Policies\Microsoft\Security\CheckAdminSettings
DWORD med värdet 1

Som du ser är det ganska besvärligt att få till men fullt möjligt.

Mvh

Göran L


Svara

Sv:Mail från access

Postades av 2005-04-07 12:47:17 - Åsa Holmgren

Eller så skaffar du Outlook Redemption:

http://www.dimastr.com/redemption/


Svara

Sv: Mail från access

Postades av 2005-04-07 14:08:34 - Åsa Holmgren

De gånger Outlook slutade att fungera, hade du Outlook igång på din dator innan koden kördes?


Svara

Sv:Mail från access

Postades av 2005-04-07 14:44:33 - Fredrik Johansson

Tror inte det har spelat någon roll om Outlook varit igång eller inte, återkommer när jag är säker på hur det har varit. Lyckas inte få det att hänga sig just nu. *S*

Har varit med om en liknande grej förr och då med mediaplayer. Då va det efter att jag skapat en lösning med VB.NET där jag använd mediaplayer i applikationen. Den gången va man till och med tvungen att installera om hela mediaplayern.


Svara

Sv: Mail från access

Postades av 2005-04-10 03:39:53 - Mattias Pettersson

Om du använder CDO via VBA istället för Outlook slipper du sånna här problem (samt ev. säkerhetsvarningar i outlook) och användaren måste inte ha aoutlook installerat/konfigurerat på kilenten (du måste dock veta vad din mailserver heter och sätta det i koden eller från en textruta i access)


Svara

Sv:Mail från access

Postades av 2005-04-12 00:41:42 - Fredrik Johansson

Nu fungerar det i stort sett felfritt så vi stänger denna, tack för all hjälp!


Svara

Sv: Mail från access

Postades av 2005-04-13 13:38:28 - Pelle Johansson

Hittade en artikel om just DoCmd som kanske är bra?

http://www.blueclaw-db.com/docmd_sendobject_example.htm

Microsoft Access Docmd.SendObject Method Example
You can use the SendObject action to include the specified Microsoft Access datasheet, form, report, module, or data access page in an electronic mail message, where it can be viewed and forwarded. You can include objects in Microsoft Excel 2000 (*.xls), MS-DOS text (*.txt), rich-text (*.rtf), or HTML (*.html) format in messages for Microsoft Outlook, Microsoft Exchange, or another electronic mail application that uses the Mail Applications Programming Interface (MAPI).



The SendObject method carries out the Docmd SendObject action in Visual Basic.

DoCmd.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)

ObjectType - Optional AcSendObjectType.

AcSendObjectType - Can be one of these constants.


acSendDataAccessPage
acSendForm
acSendModule
acSendNoObject default
acSendQuery
acSendReport
acSendTable

ObjectName - An optional string variant expression that's the valid name of an object of the type selected by the objecttype argument. If you want to include the active object in the mail message, specify the object's type with the objecttype argument and leave this argument blank. If you leave both the objecttype and objectname arguments blank (the default constant, acSendNoObject, is assumed for the objecttype argument), Microsoft Access sends a message to the electronic mail application without an included database object. If you run Visual Basic code containing the SendObject method in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.

OutputFormat - Optional Variant.

To - An optional string expression that lists the recipients whose names you want to put on the To line in the mail message. Separate the recipient names you specify in this argument and in the cc and bcc arguments with a semicolon (;) or with the list separator set on the Number tab of the Regional Settings Properties dialog box in Windows Control Panel. If the recipient names aren't recognized by the mail application, the message isn't sent and an error occurs. If you leave this argument blank, Microsoft Access prompts you for the recipients.

Cc - An optional string expression that lists the recipients whose names you want to put on the Cc line in the mail message. If you leave this argument blank, the Cc line in the mail message is blank.

Bcc - An optional string expression that lists the recipients whose names you want to put on the Bcc line in the mail message. If you leave this argument blank, the Bcc line in the mail message is blank.

Subject - An optional string expression containing the text you want to put on the Subject line in the mail message. If you leave this argument blank, the Subject line in the mail message is blank.

MessageText - An optional string expression containing the text you want to include in the body of the mail message, after the object. If you leave this argument blank, the object is all that's included in the body of the mail message.

EditMessage - Optional - use True (–1) to open the electronic mail application immediately with the message loaded, so the message can be edited. Use False (0) to send the message without editing it. If you leave this argument blank, the default (True) is assumed.

TemplateFile - Optional string expression that's the full name, including the path, of the file you want to use as a template for an HTML file.


Svara

Nyligen

  • 08:28 Butiksskyltar: Hur upplever utbude
  • 22:31 Slappna av
  • 19:55 kick-off med fokus på hälsa?
  • 19:53 kick-off med fokus på hälsa?
  • 16:24 Föreslå en skönhetsklinik online
  • 16:23 Föreslå en skönhetsklinik online
  • 18:42 Hvor finder man håndlavede lamper
  • 18:41 Hvor finder man håndlavede lamper

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 570 770
27 960
271 761
396
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies