Access should be able to share tables with Outlook and Business C.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In order to have a complete database, the information that is used in Outlook
and Business Contact Manager must be duplicated in the Access Database
(Names, Addresses, E-mail, etc.). It would be helpful to be able to query
the tables for Outlook to eliminate the need of entering the same info in two
different places.
 
What are you trying to accomplish? There are ways to bidirectionally
exchange data between Outlook & Access either on a record/item level,
batch or subset of data/items.

David H
 
olsonsxq said:
In order to have a complete database, the information that is used in
Outlook
and Business Contact Manager must be duplicated in the Access Database
(Names, Addresses, E-mail, etc.). It would be helpful to be able to query
the tables for Outlook to eliminate the need of entering the same info in
two
different places.

File | Get External Data | Link Tables

Select 'Outlook' or 'Exchange' as the type of datasource
(depending on what exactly you are trying to do)

I just linked to my contacts list and got these fields:

FirstLastTitleCompanyDepartmentOfficePost Office
BoxAddressCityStateZip/Postal CodeCountryPhoneMobile PhonePager PhoneHome2
PhoneAssistant Phone NumberBusiness FaxHome FaxOther FaxTelex NumberDisplay
nameEmail TypeEmail AddressAccountAssistantSend Rich TextPrimaryFile AsHome
AddressBusiness AddressOther AddressJournalWeb PageBusiness Address
StreetBusiness Address CityBusiness Address StateBusiness Address Postal
CodeBusiness Address CountryBusiness Address PO BoxUser Field 1User Field
2User Field 3User Field 4


(david)
 
I was looking for the same information as olsonsxq. I have made the link to
Outlook, but it is so incredible slow that it is mostly unusable. My contact
folder is 1100+ names and about to triple. Any ideas on speeding it up?
Running 1600mhz 512mb. It seems like it is a live link that is constantly
refreshing itself.

Any ideas

Thanks
 
One more thing, I noticed that I cannot add new contacts through Access. I
can only edit exsisting ones. Any ideas?

Thanks
 
But that's not neccessary. By creating UserDefinded Properties in
Outlook, you can add any information that you need including the key
value for ANY Access Record. Using VBA and the Outlook Object Model it
is possible to create any Outlook Item you can think of (MailItem,
AppointmentItem, TaskItem, Contacts). The first three function reside in
Access are the the ones that I use to manage AppointmentItems in my
Outlook calendar that represent vehicle reservations. The AccessDB is
the system of record, Outlook is there just to give a visual display of
them and to allow me to sync them to my PPC. When the reservation is
updated in Access, the information is reflected in Outlook. Actually, I
delete any items associated with the Access record and create a new one.
Prior to implementing this, I did have a function that took the
AppointmentItem and simply updated the information by grabbing it with
the recordId from Access. Now, on the Outlook side of things, the code
further down reaches out to Access and updates the record accordingly.
This allows me to open up the Reservation in Outlook (using a custom
form), change the date/time and have the mod cascade back to Outlook.
The code also allows me to drag and drop the appointment item on my
calendar and have the mod update to Access as well. (Its SOOO Coool!)

Anyways, my point is that I think that it is possible to meet the
underlying BUSINESS NEED by understanding the possibilities that already
exist thanks to Billy up in Redmond. At any rate, with some
imaginaation, GOOGLING, and knowledge of the both the Access & Outlook
Object Models you my find that you can do what you want. You would use
Access to create the CONTACT and update it if neccessary. Outlook would
reach out to Access and update the CONTACT record if the user updated
the record in Outlook. (Pardon the soapbox, but I'm quite proud of the
work that I've done to integrate the two and would like to seem others
doing the same) Sidepoint: You won't need to LINK to your Outlook *.pst
file since the Access/Outlook interface ONLY occurs when the Item is
created or updated which would still keep the records in sync.
[Stepping off of the Soapbox]


David H.


-----------ACCESS FUNCTIONS/SUBS---------------------------

Function createOutlookAppointmentFromId(lngTransportId As Long, frm As
Variant)

Dim objOutlook As Outlook.Application
Dim newAppt As Outlook.AppointmentItem
Dim strLocation As String
Dim strWhereStatement As String
Dim lngOrgKey As Long
Dim lngDestKey As Long
Dim lngPrimaryPassengerId As Long
Dim strPrimaryPassengerFirstName As String
Dim strPrimaryPassengerLastName As String
Dim i As Integer

DoCmd.Hourglass (True)
If IsNull(frm) = False Then
frm!txtAdvisory = "Looking up appointment details from database"
frm.Repaint
End If

If IsNull(frm) = False Then
frm!txtAdvisory = "Accessing Outlook"
frm.Repaint
End If

Set objOutlook = CreateObject("Outlook.application")
Set newAppt = objOutlook.CreateItem(olAppointmentItem)

newAppt.UserProperties.Add "dbAccessID", olNumber
newAppt.UserProperties.Add "dbLastModified", olDateTime
newAppt.UserProperties.Add "dbStatus", olText

If IsNull(frm) = False Then
frm![txtAdvisory] = "Creating new appointment"
frm.Repaint
End If

With newAppt
.Start = dteDate & " " & dteTimeScheduled
.End = dteDate & " " & DateAdd("h", 1, CDate(dteTimeScheduled))
.Subject = strPrimaryPassenger
.Location = strLocation
.UserProperties(1) = lngTransportId
.UserProperties(2) = Now
.UserProperties(3) = strStatusDescription
.Body = getBodyText(lngTransportId)
.BusyStatus = olBusy
.Categories = "Reservations"
.MessageClass = "IPM.Appointment.Reservations"
.Save
createOutlookAppointmentFromId = newAppt.EntryID
End With

On Error GoTo 0

If IsNull(frm) = False Then
frm![txtAdvisory] = "New appointment created"
frm.Repaint
End If

If Err.Number <> 0 Then createOutlookAppointmentFromId = Null

DoCmd.Hourglass (False)

Set newAppt = Nothing
Set objOutlook = Nothing

If IsNull(frm) = False Then
frm![txtAdvisory] = ""
frm.Repaint
End If

End Function

Function changeOutlookAppointmentFromId(lngTransportId As Long, frm As
Variant)

Select Case deleteOutlookAppointmentByTransportId(lngTransportId, Null)
Case 0, -1
changeOutlookAppointmentFromId =
createOutlookAppointmentFromId(lngTransportId, Null)
Case Else
changeOutlookAppointmentFromId = Null
End Select

End Function
Function deleteOutlookAppointmentByTransportId(lngTransportId As Long,
frm As Variant)

Dim objOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim targetCalendar As Outlook.MAPIFolder
Dim targetItems As Outlook.Items
Dim i As Integer
Dim aOutlookEntryIds()
Dim appointmentCount As Integer
Dim targetAppointment As Outlook.AppointmentItem
Dim strFilter As String

Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")
Set targetCalendar = nms.GetDefaultFolder(olFolderCalendar)
strFilter = "[dbAccessId]=" & Chr(34) & lngTransportId & Chr(34)
Set targetItems = targetCalendar.Items.Restrict(strFilter)

ReDim aOutlookEntryIds(targetItems.Count)
For i = 1 To targetItems.Count
Debug.Print i
aOutlookEntryIds(i) = targetItems(i).EntryID
Next i

Select Case targetItems.Count
Case 0
Debug.Print "AppointmentItem not found."
deleteOutlookAppointmentByTransportId = 0
Case Else
Debug.Print targetItems.Count & " AppointmentItem(s) found.
Deleting all instances."
For i = 1 To targetItems.Count
Set targetAppointment =
nms.GetItemFromID(aOutlookEntryIds(i))
Debug.Print targetAppointment.UserProperties(1),
targetAppointment.Start, targetAppointment.Subject
targetAppointment.Delete
Debug.Print "Appoint ID: " & aOutlookEntryIds(i) & "
Deleted"
Debug.Print
Next i
deleteOutlookAppointmentByTransportId = -1
End Select

Set targetItems = Nothing
Set targetCalendar = Nothing
Set nms = Nothing
Set objOutlook = Nothing

End Function

-------------OUTLOOK FUNCTIONS/SUBS------------------------------
Dim myOlApp As New Outlook.Application
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()

Call Initialize_handler

End Sub
Public Sub Initialize_handler()

Set myOlItems =
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
Debug.Print "Initialize_Handler"

End Sub
Private Sub myOlItems_ItemChange(ByVal Item As Object)

Dim objAccess As Object
Dim db As DAO.Database
Dim rs As DAO.Recordset

DoCmd.Hourglass True
If Item.Class = olAppointment And Item.MessageClass =
"IPM.Appointment.Reservations" Then
If IsNull(Item.UserProperties("dbAccessId")) = False Then
Set objAccess = CreateObject("Access.Application")
Set db = objAccess.DBEngine.OpenDatabase("C:\Documents and
Settings\dch3\My Documents\Willard Madison\Data\Access\WMS FrontEnd
2005.mdb")
Set rs = db.OpenRecordset("SELECT * FROM tblTransports
WHERE lngTransportID = " & Item.UserProperties("dbAccessID") & ";")
If Not rs.EOF Then
rs.Edit
rs.Fields("dteDate") = FormatDateTime(Item.Start,
vbShortDate)
rs.Fields("dteTimeScheduled") =
FormatDateTime(Item.Start, vbShortTime)
rs.Update
MsgBox ("Transport #" &
Item.UserProperties("dbAccessID") & " updated.")
Else
MsgBox ("Unable to update Transport #" &
Item.UserProperties("dbAccessID") & ". Record may have been deleted.")
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Set objAccess = Nothing
End If
End If
DoCmd.Hourglass False

End Sub
 
I cannot speak as to why linking to Outlook folders can't be
updated/added by in table view as w/an Access table. However I would
imagine that its because there are assorted values that have to exist
for the item that aren't intuitive such as the Item Type and some other
stuff. You CAN however use VBA to create the ContactItem and thus its
just a matter of creating a form in Access that captures the information
for the contact. The code would be...

Sub createContactItem(frm as Object)

Dim objOutlook as Outlook.Application
Dim newContact as Outlook.ContactItem

Set objOutlook = CreateObject("Outlook.Application")
Set newContact = objOutlook.CreateItem(olContactItem)

With newContact
'Use the ref to the form to grab the data
.FirstName = frm.txtContactFirstName
.LastName = frm.txtContactLastName
.Save
end with

Set newContact = Nothing
Set objOutlook = Nothing

End sub

Using that code above, I would bet that you could be creating your
contacts via Access within a matter of hours. You'd just have to create
the form and modify the code to set the appropriate properties for the
ContactItem (See the Outlook Object Model). The ONLY additional field to
add would be a UserDefinded field in Outlook to capture the key for the
record in Access so that you can later find the ContactItem and update
or delete it as needed.

David H
 
This is exactly the information I am looking for. Thank you. It seemed to
me that the linked table was a weak way of doing it. I was simply unsure of
the correct approach. You have given me a starting point. At least I know
I'm on the right track.
I have explored ACT! as a possible solution to what I want to accomplish, it
seems that it does not have the flexibility I need for this task.

Again, Thanks


David C. Holley said:
But that's not neccessary. By creating UserDefinded Properties in
Outlook, you can add any information that you need including the key
value for ANY Access Record. Using VBA and the Outlook Object Model it
is possible to create any Outlook Item you can think of (MailItem,
AppointmentItem, TaskItem, Contacts). The first three function reside in
Access are the the ones that I use to manage AppointmentItems in my
Outlook calendar that represent vehicle reservations. The AccessDB is
the system of record, Outlook is there just to give a visual display of
them and to allow me to sync them to my PPC. When the reservation is
updated in Access, the information is reflected in Outlook. Actually, I
delete any items associated with the Access record and create a new one.
Prior to implementing this, I did have a function that took the
AppointmentItem and simply updated the information by grabbing it with
the recordId from Access. Now, on the Outlook side of things, the code
further down reaches out to Access and updates the record accordingly.
This allows me to open up the Reservation in Outlook (using a custom
form), change the date/time and have the mod cascade back to Outlook.
The code also allows me to drag and drop the appointment item on my
calendar and have the mod update to Access as well. (Its SOOO Coool!)

Anyways, my point is that I think that it is possible to meet the
underlying BUSINESS NEED by understanding the possibilities that already
exist thanks to Billy up in Redmond. At any rate, with some
imaginaation, GOOGLING, and knowledge of the both the Access & Outlook
Object Models you my find that you can do what you want. You would use
Access to create the CONTACT and update it if neccessary. Outlook would
reach out to Access and update the CONTACT record if the user updated
the record in Outlook. (Pardon the soapbox, but I'm quite proud of the
work that I've done to integrate the two and would like to seem others
doing the same) Sidepoint: You won't need to LINK to your Outlook *.pst
file since the Access/Outlook interface ONLY occurs when the Item is
created or updated which would still keep the records in sync.
[Stepping off of the Soapbox]


David H.


-----------ACCESS FUNCTIONS/SUBS---------------------------

Function createOutlookAppointmentFromId(lngTransportId As Long, frm As
Variant)

Dim objOutlook As Outlook.Application
Dim newAppt As Outlook.AppointmentItem
Dim strLocation As String
Dim strWhereStatement As String
Dim lngOrgKey As Long
Dim lngDestKey As Long
Dim lngPrimaryPassengerId As Long
Dim strPrimaryPassengerFirstName As String
Dim strPrimaryPassengerLastName As String
Dim i As Integer

DoCmd.Hourglass (True)
If IsNull(frm) = False Then
frm!txtAdvisory = "Looking up appointment details from database"
frm.Repaint
End If

If IsNull(frm) = False Then
frm!txtAdvisory = "Accessing Outlook"
frm.Repaint
End If

Set objOutlook = CreateObject("Outlook.application")
Set newAppt = objOutlook.CreateItem(olAppointmentItem)

newAppt.UserProperties.Add "dbAccessID", olNumber
newAppt.UserProperties.Add "dbLastModified", olDateTime
newAppt.UserProperties.Add "dbStatus", olText

If IsNull(frm) = False Then
frm![txtAdvisory] = "Creating new appointment"
frm.Repaint
End If

With newAppt
.Start = dteDate & " " & dteTimeScheduled
.End = dteDate & " " & DateAdd("h", 1, CDate(dteTimeScheduled))
.Subject = strPrimaryPassenger
.Location = strLocation
.UserProperties(1) = lngTransportId
.UserProperties(2) = Now
.UserProperties(3) = strStatusDescription
.Body = getBodyText(lngTransportId)
.BusyStatus = olBusy
.Categories = "Reservations"
.MessageClass = "IPM.Appointment.Reservations"
.Save
createOutlookAppointmentFromId = newAppt.EntryID
End With

On Error GoTo 0

If IsNull(frm) = False Then
frm![txtAdvisory] = "New appointment created"
frm.Repaint
End If

If Err.Number <> 0 Then createOutlookAppointmentFromId = Null

DoCmd.Hourglass (False)

Set newAppt = Nothing
Set objOutlook = Nothing

If IsNull(frm) = False Then
frm![txtAdvisory] = ""
frm.Repaint
End If

End Function

Function changeOutlookAppointmentFromId(lngTransportId As Long, frm As
Variant)

Select Case deleteOutlookAppointmentByTransportId(lngTransportId, Null)
Case 0, -1
changeOutlookAppointmentFromId =
createOutlookAppointmentFromId(lngTransportId, Null)
Case Else
changeOutlookAppointmentFromId = Null
End Select

End Function
Function deleteOutlookAppointmentByTransportId(lngTransportId As Long,
frm As Variant)

Dim objOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim targetCalendar As Outlook.MAPIFolder
Dim targetItems As Outlook.Items
Dim i As Integer
Dim aOutlookEntryIds()
Dim appointmentCount As Integer
Dim targetAppointment As Outlook.AppointmentItem
Dim strFilter As String

Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")
Set targetCalendar = nms.GetDefaultFolder(olFolderCalendar)
strFilter = "[dbAccessId]=" & Chr(34) & lngTransportId & Chr(34)
Set targetItems = targetCalendar.Items.Restrict(strFilter)

ReDim aOutlookEntryIds(targetItems.Count)
For i = 1 To targetItems.Count
Debug.Print i
aOutlookEntryIds(i) = targetItems(i).EntryID
Next i

Select Case targetItems.Count
Case 0
Debug.Print "AppointmentItem not found."
deleteOutlookAppointmentByTransportId = 0
Case Else
Debug.Print targetItems.Count & " AppointmentItem(s) found.
Deleting all instances."
For i = 1 To targetItems.Count
Set targetAppointment =
nms.GetItemFromID(aOutlookEntryIds(i))
Debug.Print targetAppointment.UserProperties(1),
targetAppointment.Start, targetAppointment.Subject
targetAppointment.Delete
Debug.Print "Appoint ID: " & aOutlookEntryIds(i) & "
Deleted"
Debug.Print
Next i
deleteOutlookAppointmentByTransportId = -1
End Select

Set targetItems = Nothing
Set targetCalendar = Nothing
Set nms = Nothing
Set objOutlook = Nothing

End Function

-------------OUTLOOK FUNCTIONS/SUBS------------------------------
Dim myOlApp As New Outlook.Application
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()

Call Initialize_handler

End Sub
Public Sub Initialize_handler()

Set myOlItems =
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
Debug.Print "Initialize_Handler"

End Sub
Private Sub myOlItems_ItemChange(ByVal Item As Object)

Dim objAccess As Object
Dim db As DAO.Database
Dim rs As DAO.Recordset

DoCmd.Hourglass True
If Item.Class = olAppointment And Item.MessageClass =
"IPM.Appointment.Reservations" Then
If IsNull(Item.UserProperties("dbAccessId")) = False Then
Set objAccess = CreateObject("Access.Application")
Set db = objAccess.DBEngine.OpenDatabase("C:\Documents and
Settings\dch3\My Documents\Willard Madison\Data\Access\WMS FrontEnd
2005.mdb")
Set rs = db.OpenRecordset("SELECT * FROM tblTransports
WHERE lngTransportID = " & Item.UserProperties("dbAccessID") & ";")
If Not rs.EOF Then
rs.Edit
rs.Fields("dteDate") = FormatDateTime(Item.Start,
vbShortDate)
rs.Fields("dteTimeScheduled") =
FormatDateTime(Item.Start, vbShortTime)
rs.Update
MsgBox ("Transport #" &
Item.UserProperties("dbAccessID") & " updated.")
Else
MsgBox ("Unable to update Transport #" &
Item.UserProperties("dbAccessID") & ". Record may have been deleted.")
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Set objAccess = Nothing
End If
End If
DoCmd.Hourglass False

End Sub


I was looking for the same information as olsonsxq. I have made the link to
Outlook, but it is so incredible slow that it is mostly unusable. My contact
folder is 1100+ names and about to triple. Any ideas on speeding it up?
Running 1600mhz 512mb. It seems like it is a live link that is constantly
refreshing itself.

Any ideas

Thanks



:
 
Hope I wasn't too preachy!
This is exactly the information I am looking for. Thank you. It seemed to
me that the linked table was a weak way of doing it. I was simply unsure of
the correct approach. You have given me a starting point. At least I know
I'm on the right track.
I have explored ACT! as a possible solution to what I want to accomplish, it
seems that it does not have the flexibility I need for this task.

Again, Thanks


:

But that's not neccessary. By creating UserDefinded Properties in
Outlook, you can add any information that you need including the key
value for ANY Access Record. Using VBA and the Outlook Object Model it
is possible to create any Outlook Item you can think of (MailItem,
AppointmentItem, TaskItem, Contacts). The first three function reside in
Access are the the ones that I use to manage AppointmentItems in my
Outlook calendar that represent vehicle reservations. The AccessDB is
the system of record, Outlook is there just to give a visual display of
them and to allow me to sync them to my PPC. When the reservation is
updated in Access, the information is reflected in Outlook. Actually, I
delete any items associated with the Access record and create a new one.
Prior to implementing this, I did have a function that took the
AppointmentItem and simply updated the information by grabbing it with
the recordId from Access. Now, on the Outlook side of things, the code
further down reaches out to Access and updates the record accordingly.
This allows me to open up the Reservation in Outlook (using a custom
form), change the date/time and have the mod cascade back to Outlook.
The code also allows me to drag and drop the appointment item on my
calendar and have the mod update to Access as well. (Its SOOO Coool!)

Anyways, my point is that I think that it is possible to meet the
underlying BUSINESS NEED by understanding the possibilities that already
exist thanks to Billy up in Redmond. At any rate, with some
imaginaation, GOOGLING, and knowledge of the both the Access & Outlook
Object Models you my find that you can do what you want. You would use
Access to create the CONTACT and update it if neccessary. Outlook would
reach out to Access and update the CONTACT record if the user updated
the record in Outlook. (Pardon the soapbox, but I'm quite proud of the
work that I've done to integrate the two and would like to seem others
doing the same) Sidepoint: You won't need to LINK to your Outlook *.pst
file since the Access/Outlook interface ONLY occurs when the Item is
created or updated which would still keep the records in sync.
[Stepping off of the Soapbox]


David H.


-----------ACCESS FUNCTIONS/SUBS---------------------------

Function createOutlookAppointmentFromId(lngTransportId As Long, frm As
Variant)

Dim objOutlook As Outlook.Application
Dim newAppt As Outlook.AppointmentItem
Dim strLocation As String
Dim strWhereStatement As String
Dim lngOrgKey As Long
Dim lngDestKey As Long
Dim lngPrimaryPassengerId As Long
Dim strPrimaryPassengerFirstName As String
Dim strPrimaryPassengerLastName As String
Dim i As Integer

DoCmd.Hourglass (True)
If IsNull(frm) = False Then
frm!txtAdvisory = "Looking up appointment details from database"
frm.Repaint
End If

If IsNull(frm) = False Then
frm!txtAdvisory = "Accessing Outlook"
frm.Repaint
End If

Set objOutlook = CreateObject("Outlook.application")
Set newAppt = objOutlook.CreateItem(olAppointmentItem)

newAppt.UserProperties.Add "dbAccessID", olNumber
newAppt.UserProperties.Add "dbLastModified", olDateTime
newAppt.UserProperties.Add "dbStatus", olText

If IsNull(frm) = False Then
frm![txtAdvisory] = "Creating new appointment"
frm.Repaint
End If

With newAppt
.Start = dteDate & " " & dteTimeScheduled
.End = dteDate & " " & DateAdd("h", 1, CDate(dteTimeScheduled))
.Subject = strPrimaryPassenger
.Location = strLocation
.UserProperties(1) = lngTransportId
.UserProperties(2) = Now
.UserProperties(3) = strStatusDescription
.Body = getBodyText(lngTransportId)
.BusyStatus = olBusy
.Categories = "Reservations"
.MessageClass = "IPM.Appointment.Reservations"
.Save
createOutlookAppointmentFromId = newAppt.EntryID
End With

On Error GoTo 0

If IsNull(frm) = False Then
frm![txtAdvisory] = "New appointment created"
frm.Repaint
End If

If Err.Number <> 0 Then createOutlookAppointmentFromId = Null

DoCmd.Hourglass (False)

Set newAppt = Nothing
Set objOutlook = Nothing

If IsNull(frm) = False Then
frm![txtAdvisory] = ""
frm.Repaint
End If

End Function

Function changeOutlookAppointmentFromId(lngTransportId As Long, frm As
Variant)

Select Case deleteOutlookAppointmentByTransportId(lngTransportId, Null)
Case 0, -1
changeOutlookAppointmentFromId =
createOutlookAppointmentFromId(lngTransportId, Null)
Case Else
changeOutlookAppointmentFromId = Null
End Select

End Function
Function deleteOutlookAppointmentByTransportId(lngTransportId As Long,
frm As Variant)

Dim objOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim targetCalendar As Outlook.MAPIFolder
Dim targetItems As Outlook.Items
Dim i As Integer
Dim aOutlookEntryIds()
Dim appointmentCount As Integer
Dim targetAppointment As Outlook.AppointmentItem
Dim strFilter As String

Set objOutlook = CreateObject("Outlook.application")
Set nms = objOutlook.GetNamespace("MAPI")
Set targetCalendar = nms.GetDefaultFolder(olFolderCalendar)
strFilter = "[dbAccessId]=" & Chr(34) & lngTransportId & Chr(34)
Set targetItems = targetCalendar.Items.Restrict(strFilter)

ReDim aOutlookEntryIds(targetItems.Count)
For i = 1 To targetItems.Count
Debug.Print i
aOutlookEntryIds(i) = targetItems(i).EntryID
Next i

Select Case targetItems.Count
Case 0
Debug.Print "AppointmentItem not found."
deleteOutlookAppointmentByTransportId = 0
Case Else
Debug.Print targetItems.Count & " AppointmentItem(s) found.
Deleting all instances."
For i = 1 To targetItems.Count
Set targetAppointment =
nms.GetItemFromID(aOutlookEntryIds(i))
Debug.Print targetAppointment.UserProperties(1),
targetAppointment.Start, targetAppointment.Subject
targetAppointment.Delete
Debug.Print "Appoint ID: " & aOutlookEntryIds(i) & "
Deleted"
Debug.Print
Next i
deleteOutlookAppointmentByTransportId = -1
End Select

Set targetItems = Nothing
Set targetCalendar = Nothing
Set nms = Nothing
Set objOutlook = Nothing

End Function

-------------OUTLOOK FUNCTIONS/SUBS------------------------------
Dim myOlApp As New Outlook.Application
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()

Call Initialize_handler

End Sub
Public Sub Initialize_handler()

Set myOlItems =
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Items
Debug.Print "Initialize_Handler"

End Sub
Private Sub myOlItems_ItemChange(ByVal Item As Object)

Dim objAccess As Object
Dim db As DAO.Database
Dim rs As DAO.Recordset

DoCmd.Hourglass True
If Item.Class = olAppointment And Item.MessageClass =
"IPM.Appointment.Reservations" Then
If IsNull(Item.UserProperties("dbAccessId")) = False Then
Set objAccess = CreateObject("Access.Application")
Set db = objAccess.DBEngine.OpenDatabase("C:\Documents and
Settings\dch3\My Documents\Willard Madison\Data\Access\WMS FrontEnd
2005.mdb")
Set rs = db.OpenRecordset("SELECT * FROM tblTransports
WHERE lngTransportID = " & Item.UserProperties("dbAccessID") & ";")
If Not rs.EOF Then
rs.Edit
rs.Fields("dteDate") = FormatDateTime(Item.Start,
vbShortDate)
rs.Fields("dteTimeScheduled") =
FormatDateTime(Item.Start, vbShortTime)
rs.Update
MsgBox ("Transport #" &
Item.UserProperties("dbAccessID") & " updated.")
Else
MsgBox ("Unable to update Transport #" &
Item.UserProperties("dbAccessID") & ". Record may have been deleted.")
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Set objAccess = Nothing
End If
End If
DoCmd.Hourglass False

End Sub


I was looking for the same information as olsonsxq. I have made the link to
Outlook, but it is so incredible slow that it is mostly unusable. My contact
folder is 1100+ names and about to triple. Any ideas on speeding it up?
Running 1600mhz 512mb. It seems like it is a live link that is constantly
refreshing itself.

Any ideas

Thanks



:





In order to have a complete database, the information that is used in
Outlook
and Business Contact Manager must be duplicated in the Access Database
(Names, Addresses, E-mail, etc.). It would be helpful to be able to query
the tables for Outlook to eliminate the need of entering the same info in
two
different places.

File | Get External Data | Link Tables

Select 'Outlook' or 'Exchange' as the type of datasource
(depending on what exactly you are trying to do)

I just linked to my contacts list and got these fields:

FirstLastTitleCompanyDepartmentOfficePost Office
BoxAddressCityStateZip/Postal CodeCountryPhoneMobile PhonePager PhoneHome2
PhoneAssistant Phone NumberBusiness FaxHome FaxOther FaxTelex NumberDisplay
nameEmail TypeEmail AddressAccountAssistantSend Rich TextPrimaryFile AsHome
AddressBusiness AddressOther AddressJournalWeb PageBusiness Address
StreetBusiness Address CityBusiness Address StateBusiness Address Postal
CodeBusiness Address CountryBusiness Address PO BoxUser Field 1User Field
2User Field 3User Field 4


(david)
 
Not too preachy at all!

I have a very good understanding of Access but I am only starting to learn
VBA. In fact I am now looking for a class I can take to get me started. Even
though I did not understand most of the examples you gave me, it did make me
realize that I have come as far as I can without learning to code.

On a side note maybe you can suggest a book for beginners. I once ordered a
Beginning VBA book from a bookstore, waited patiently for 2 weeks and found
that is was NOT VBA book, but a book about programing with wizards and
macros.

I bought a different book (ISBN 1-861001-76-2) "Beginning Access 2000 VBA."
-By David Sussman and Robert Smith. All was great until it took a huge leap
forward that left me endlessly flipping back chapters to find the chapter
that must have been left out of the book. There is some fundemantal thing
that I just don't get. If I had a day class to get started I am sure it
would all be clear. Have not programmed since extended basic on the Texas
Instruments TI99, or the Apple 2 (Oh great, now you can guess my age)

Anyways, you did help me; but not how you might have thought.

Thanks Again
 
Can't recommend any specific books. However the basics to programing are
the same regardless of the language. You may want to investigate if
there are any Into to Programming courses avail through a community
college and take it. As to VBA, a course in VB (Visual Basic), VBA's
bigger brother should take you rather far in terms of MS specific
concepts. Think of them as learning the basics to cooking. You don't
need to learn how to make a specific recipe, just the basics of mixing,
ingrediants, herbs and such. The KEY to using VBA is to understand the
various Object Models which in a nutshell are blueprints to how the
various applications work and how to manipulate them via code.
 
Back
Top