Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report of data in Outlook monthly calendar format

Status
Not open for further replies.

chrisbowman

Technical User
Dec 22, 2000
1
US
I can't seem to find a solution to this problem. I would like to record information in a table that would have many entries for students over different individual dates. I want a report that has a Monday to Friday set of columns across the top so that when the report runs it lists below the students who were in the office on that day. Similar to how you would see appointments in Outlook. It would emulate the style of reporting that Outlook has in its monthly format. I am sure this can be done, and I am sure if it can be done, then someone who subscribes to this list has done it. I know many would be interested in this, and I would be most appreciative.

Thanks so much, and have a happy set of holidays!!!!

Chris
 
Chris:

You're probably still interested in this so I'll post at this late date. Here are two routines (first calls the second) that send recordset datainto the Outlook Calendar.

Since this is borrowed code, I should credit the source (Access 2000 Power Programming, F. Scott Barker, Sams, Indianapolis: 1999)

Public Sub PostVisits()
Dim db As Database
Dim rs As DAO.Recordset


Set db = CurrentDb()

Set rs = db.OpenRecordset("qry_visitstooutlook", dbOpenDynaset)

With rs

Do Until .EOF
PostToOutlook !Site, !visit, !PrjctdDate
!postedoutlk = True
.MoveNext
Loop

End With
End Sub


Public Sub PostToOutlook(v_Site As String, v_Visit As String, _
v_VisitDate As Date)
On Error GoTo ErrorPostToOutlook


Dim objOutlook As New Outlook.Application
Dim objCalendar As Outlook.MAPIFolder
Dim objNameSpace As Outlook.NameSpace

Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objCalendar = objNameSpace.GetDefaultFolder(olFolderCalendar)

With objCalendar.Items.Add(olAppointmentItem)
.AllDayEvent = True
.Subject = v_Site & ": " & v_Visit
.Start = v_VisitDate
'.End = v_VisitDate
.ReminderSet = False
.Save
End With

Exit_ErrorPostToOutlook:
Exit Sub

ErrorPostToOutlook:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_ErrorPostToOutlook



End Sub
 
Where should I enter this code in order to get it to run? Ro I put it in the code for the button's click event? Etc... also, I tried to run it, but it kept kicking me back with invalid var's "DataBase" and DAO.Recordset...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top