Results 1 to 3 of 3
  1. #1
    ZJGMoparman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    24

    Report Display Data linked to two separate entries

    I am trying to create a customized database for our NFL Football Pool. Each week a pick sheet will be sent out to everyone in the pool in PDF format. I have several things I would like to do with this report:



    1. Is it possible to pull the team logo from my "tblTeams" table and display beside each team on the report. I can get either the home team logo or the visitor team logo, but I cannot get both.

    2. Is it possible to export this report in a PDF format and make the empty box shown in the report "clickable." In other words, when the user opens the report, they can click on the box of their pick, and an "X" will be placed in the box.

    3. Is it possible to send this report (in PDF format) to each user's email that is participating in the pool. The "tblParticipants" table stores an email address for each person participating.



    I am attaching the database I have so far, as well as the report saved in a PDF format.

    rptWeeklySchedule.pdf

    NFL.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    1 yes, in your tblTeams, make a field of OLE type. Paste your icon in the field. (i use this)

    2. no, once in pdf format nobody can change it. Instead of a report, I would send the data as XLS and let users mark an X in the column
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, vQry, vFile, True, "Football"

    3. yes, in a list box show the users emails , put a button on the form, when clicked it will scan the list and send each 1 an email


    The btnSend_click will then scan the list of people and send them the report.

    Code:
    sub btnSend_Click()
    vQry = "qsFootballData"
    vFile = "c:\folder\football.xls"
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, vQry, vFile, True, "football"
    
    
      'scan items in listbox
    For i = 0 To lstClients.ListCount - 1
       vTo = lstClients.ItemData(i)
       lstClients = vTo
            
        Call Email1(vTo,"subject","body", "c:\folder\football.xls"
    
    
          ' but to send the pdf rpt:
        'DoCmd.SendObject acSendReport, "rReport", acFormatPDF, lstPerson , , "subject", "msg body"
    next
    end sub

    'here is the email part. You must load OUTLOOK in the tools, references

    Code:
    Public Function Email1(ByVal pvTo, ByVal pvSubj, ByVal pvBody, optional ByVal pvFile) As Boolean
    Dim oApp As Outlook.Application
    Dim oMail As Outlook.MailItem
    
    
    On Error GoTo ErrMail
    
    
        'NOTE  BE SURE YOU ADD OUTLOOK APP VIA  VBE menu:TOOLS, REFERENCES
    
    
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(olMailItem)
    
    
    With oMail
        .To = pvTo
        .Subject = pvSubj
        .Body = pvBody
        
        if not isempty(pvFile) then  .Attachments.Add pvFile, olByValue, 1
        .Send
    End With
    
    
    Email1 = True
    endIt:
    Set oMail = Nothing
    Set oApp = Nothing
    Exit Function
    
    
    ErrMail:
    MsgBox Err.Description, vbCritical, Err
    Resume endit
    End Function

  3. #3
    ZJGMoparman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    24
    Quote Originally Posted by ranman256 View Post
    1 yes, in your tblTeams, make a field of OLE type. Paste your icon in the field. (i use this)

    2. no, once in pdf format nobody can change it. Instead of a report, I would send the data as XLS and let users mark an X in the column
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, vQry, vFile, True, "Football"

    3. yes, in a list box show the users emails , put a button on the form, when clicked it will scan the list and send each 1 an email


    The btnSend_click will then scan the list of people and send them the report.

    Code:
    sub btnSend_Click()
    vQry = "qsFootballData"
    vFile = "c:\folder\football.xls"
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, vQry, vFile, True, "football"
    
    
      'scan items in listbox
    For i = 0 To lstClients.ListCount - 1
       vTo = lstClients.ItemData(i)
       lstClients = vTo
            
        Call Email1(vTo,"subject","body", "c:\folder\football.xls"
    
    
          ' but to send the pdf rpt:
        'DoCmd.SendObject acSendReport, "rReport", acFormatPDF, lstPerson , , "subject", "msg body"
    next
    end sub

    'here is the email part. You must load OUTLOOK in the tools, references

    Code:
    Public Function Email1(ByVal pvTo, ByVal pvSubj, ByVal pvBody, optional ByVal pvFile) As Boolean
    Dim oApp As Outlook.Application
    Dim oMail As Outlook.MailItem
    
    
    On Error GoTo ErrMail
    
    
        'NOTE  BE SURE YOU ADD OUTLOOK APP VIA  VBE menu:TOOLS, REFERENCES
    
    
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(olMailItem)
    
    
    With oMail
        .To = pvTo
        .Subject = pvSubj
        .Body = pvBody
        
        if not isempty(pvFile) then  .Attachments.Add pvFile, olByValue, 1
        .Send
    End With
    
    
    Email1 = True
    endIt:
    Set oMail = Nothing
    Set oApp = Nothing
    Exit Function
    
    
    ErrMail:
    MsgBox Err.Description, vbCritical, Err
    Resume endit
    End Function

    Thanks for the reply ranman256.

    As far as my first question, unless I am missing something, having an OLE field will not fix my issue. I currently have a "logo" field as an attachment. The problem is, when I create the report, it is only pulling one logo instead of the one for both teams. The logo field is linking to only the home team or only the away team. I can't get it to work for both at the same time.

    See the attached example. Schedule With Logos.pdf

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-30-2015, 08:40 PM
  2. Matching entries from separate lists
    By forbes61 in forum Access
    Replies: 3
    Last Post: 01-12-2015, 05:22 PM
  3. Replies: 4
    Last Post: 06-07-2014, 01:54 PM
  4. Replies: 3
    Last Post: 02-12-2013, 11:26 AM
  5. Combining separate excel report data
    By mikebravo in forum Import/Export Data
    Replies: 7
    Last Post: 04-16-2012, 01:16 PM

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