Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954

    I'm not sure why you say my app is way out of your league. Much of the code will be almost as the same as you have now.

    To try it out, enter your email settings in the form and send a test email to e.g.yourself.
    You will be told whether it is successful and if not you can lookup the error in the attached help file.

    To use it in your own apps, copy the table tblSettings, the module modFunctions and, optionally, modify the form as required.
    That's it.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  2. #17
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by davedinger View Post
    ...but Vlad is correct, there will only be one record in the table that will contain only the current relevant data.
    That might be the plan NOW, but things can change.
    IMHO, I consider it bad programming practice not to plan for mistakes/chamges. Again, this is MY opinion. It is so easy to add the criteria to ensure the correct record is returned.


    Good luck with your project.....

  3. #18
    davedinger is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Location
    South Dakota
    Posts
    63
    OH Happy Day!!! It works Perfectly!

    Click image for larger version. 

Name:	snoopy.png 
Views:	11 
Size:	5.3 KB 
ID:	41456
    Thanks Valad and all that helped!!
    Below is the final table and all the code for those that need it:

    The Table
    Click image for larger version. 

Name:	Capture3.JPG 
Views:	10 
Size:	45.3 KB 
ID:	41457

    The Code

    Private Sub Command31_Click()
    '******************************************
    '******** Create PDF file and Email******
    '******************************************
    'Create File
    DoCmd.OutputTo acOutputReport, "Daily Scan", "PDFFormat(*.pdf)", "", False, "", , acExportQualityPrint
    Beep
    MsgBox "File Created Now E-mailing", vbInformation, ""
    DoCmd.Close acReport, "Daily Scan"


    ' send via E mail
    '"Send reports Via Visual Basic E-Mail****"
    Dim objCDOConfig As Object
    Dim objCDOMessage As Object


    Dim CurrentFolder As String
    Dim Filename As String
    Dim myPath As String
    Dim UniqueName As Boolean

    UniqueName = False


    'setting smtp gmail mail

    Const cdoschema = "http://schemas.microsoft.com/cdo/configuration/"
    Const cdoSendUsingPort = 2
    Const cdoBasic = 1


    Dim strSMTPServer As String
    Dim strFrom As String


    strSMTPServer = DLookup("[ServerAddress]", "[TblEmailSettings]")
    strFrom = DLookup("[EmailAccount]", "[TblEmailSettings]")


    Set objCDOConfig = CreateObject("CDO.Configuration")
    With objCDOConfig.Fields
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer 'DLookup("[ServerAddress]", "[TblEmailSettings]")
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = strFrom 'DLookup("[EmailAccount]", "[TblEmailSettings]")
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = DLookup("[AccountPassword]", "[TblEmailSettings]")
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
    .Update


    End With
    'setting smtp gmail complete
    Set objCDOMessage = CreateObject("CDO.Message")
    With objCDOMessage
    Set .Configuration = objCDOConfig
    .From = strFrom
    .Sender = strFrom
    .To = Forms![Customer Form Selector]![Primary E-mail]
    .CC = DLookup("[CCSender]", "[TblEmailSettings]")
    .Subject = DLookup("[SubjectLine]", "[TblEmailSettings]")
    .TextBody = DLookup("[Message]", "[TblEmailSettings]")
    .AddAttachment ("C:\Users\Dave\Documents\Daily Scan.pdf")
    .Send
    End With
    'Kill FileName & "*.XLS"
    Beep
    MsgBox "E-mail Sent", vbInformation, ""


    End Sub

  4. #19
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Glad to hear you got it working and sorry for misleading you in few spots!

    Good luck with your project and stay safe!

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-14-2015, 01:58 PM
  2. Replies: 6
    Last Post: 01-17-2014, 03:43 PM
  3. Access Options, Client settings
    By crowegreg in forum Access
    Replies: 3
    Last Post: 08-10-2012, 10:04 PM
  4. Sending email on windows server 2008
    By Randy in forum Access
    Replies: 0
    Last Post: 03-20-2012, 08:35 AM
  5. Report settings at runtime in Access 2007
    By soringc in forum Programming
    Replies: 0
    Last Post: 11-22-2007, 10:04 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums