Link To Outlook Address Book Slow

D

DEI

Greetings,

I would like the display names in an Outlook global address list to be
available in a combo box on a form in MS Access. I have created a linked
table to the
Outlook Global Address list in the database, and am referencing the table in
the form, but it operates at an unacceptably slow speed. I can select the
names, but the autocomplete takes minutes find the name.

Is there some way of retrieving these values from the Outlook object model
programmatically so that it runs much faster? I would ultimately like for
the user to be able to select a name from the list.

Incidentally, I can retrive AddressEntries properties via the Outlook Object
model, but I get the warning message each tim the code tried to retirve a
proprty (i.e. name, etc.)

Thanks in advance.

DEI
 
S

Salad

DEI said:
Greetings,

I would like the display names in an Outlook global address list to be
available in a combo box on a form in MS Access. I have created a linked
table to the
Outlook Global Address list in the database, and am referencing the table in
the form, but it operates at an unacceptably slow speed. I can select the
names, but the autocomplete takes minutes find the name.

Is there some way of retrieving these values from the Outlook object model
programmatically so that it runs much faster? I would ultimately like for
the user to be able to select a name from the list.

Incidentally, I can retrive AddressEntries properties via the Outlook Object
model, but I get the warning message each tim the code tried to retirve a
proprty (i.e. name, etc.)

Thanks in advance.

DEI
When listboxes or combos get too complicated I suggest using a UDF (user
defined function) rowtype instead of ValueList or Table/Query. Here's
some code I provided to someone in the Access newsgroup to demonstrate
how to make one. It scans all of the queries in the database and
presents them in a listbox. Once you make a UDF rowtype you have the
template for any others you need in the future.

You can find an explanation of a combo/listbox UDF in help. In A97, the
topic is "RowSourceType Property (User-Defined Function) — Code Argument
Values"

I dropped this code in the form's code module.

Option Explicit
Option Compare Database
Private Type QueryList
'change the type name/column names to whatever you like.
QueryName As Variant
'QueryDate as Date
'add any other columns associated with this type
End Type
Private Function FillQueryList(fld As Control, ID As Variant, row As
Variant, col As Variant, Code As Variant) As Variant
On Error Resume Next

Static strRows() As QueryList
Static Entries As Integer
Dim qdf As QueryDef
Dim ReturnVal As Variant

ReturnVal = Null

Select Case Code
Case acLBInitialize ' Initialize.

Entries = 0
ReDim Preserve strRows(Entries)

'creates header/column row. Useful if colheads is True
strRows(Entries).QueryName = "Query Name"

For Each qdf In CurrentDb.QueryDefs
If Left(qdf.Name, 1) <> "~" Then
Entries = Entries + 1
ReDim Preserve strRows(Entries)
strRows(Entries).QueryName = qdf.Name
End If
Next qdf

ReturnVal = True
Case acLBOpen ' Open.
ReturnVal = Timer ' Generate unique ID for control.
Case acLBGetRowCount ' Get number of rows.
ReturnVal = Entries + 1
Case acLBGetColumnCount ' Get number of columns.
ReturnVal = 1
Case acLBGetColumnWidth ' Column width.
ReturnVal = -1 ' -1 forces use of default width.
Case acLBGetValue ' Get data.
Select Case col
Case 0
'this example has a single column.
ReturnVal = strRows(row).QueryName
'Case 1...Case column cnt
' returnVal = strRows(row).theTypeRowName
End Select
Case acLBEnd ' End.
Erase strRows
End Select
FillQueryList = ReturnVal
End Function

Now create a listbox, 1 column to display query name.

In the Listbox's RowSourceType row (under Data tab) enter
FillQueryList
without a preceding "=" and then blank out the RowSource row.

Save the form and run.


In your case, you need to modify the code under the following statements.
Case acLBInitialize ' Initialize.
'get the address list in order.
Case acLBGetColumnCount ' Get number of columns.
'change the column count if necessary
Case acLBGetValue ' Get data.
'fill in the column values.
 
K

Ken Slovak - [MVP - Outlook]

In versions earlier than Office 2007 that's the Outlook security warnings
and they will be there for any code run from Access. To learn more about
them and how to avoid them see
http://www.outlookcode.com/article.aspx?id=52.

A linked table will always be slower than object model access.

You can use object model code to populate your control but I don't know
whether that will speed up autocomplete.
 
D

Dmitry Streblechenko

Why do you want to retrieve *all* the GAL entries? Outlook never does that -
it only retrieves whatever is visible to the user (220-30 entries at a
time).
I would take another look at your design if I were you - more than a dozen
entries in a combo box makes it unusable to an end user. Thousands of
entries is certainly unacceptable.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top