Trouble accessing Exchange public folder from Access

  • Thread starter Thread starter Chris Winstone
  • Start date Start date
C

Chris Winstone

I am trying to create a connection from Access 2000 to a exchange 2000
public folder using OLEDB. And ultimately to add new contacts via an Access
Form

I am using the following code but whenever I call the open event on the
recordset object I get the following error.

Run-time error '-2147467259 (80004005)'
Query must have at least one destination field.

Can anyone shed some light on this? An/Or is this the best way to connect to
Exchange and Access.


The code I am using is as follows.

Dim ADO_Conn As ADODB.Connection
Dim ADO_RS As ADODB.Recordset
Dim StrConn As String
Set ADO_Conn = New ADODB.Connection
Set ADO_RS = New ADODB.Recordset

With ADO_Conn
.Provider = "Microsoft.JET.OLEDB.4.0"
.ConnectionString = "Exchange 4.0;PROFILE=Outlook;MAPILevel = Public
Folders|All Public Folders\;TABLETYPE=0;DATABASE=D:\Databases\Temp"
.Open
End With

'Connection seems open fine

With ADO_RS
Set .ActiveConnection = ADO_Conn
.CursorType = adOpenStatic
.LockType = adLockReadOnly

.Open "Select * from [ABZ Group Contacts]" 'ERROR OCCURS HERE

.MoveFirst
'As a test just itterate to the first contact
Dim i As Long
For i = 0 To ADO_RS.Fields.Count - 1
Debug.Print ADO_RS(i).Name + vbTab + Format(ADO_RS(i).Value)
Next i
.close
End With

Set ADO_RS = Nothing
ADO_Conn.close
Set ADO_Conn = Nothing
 
This newsgroup is for Outlook VBA programming. Please repost in an ADO
newsgroup or microsoft.public.exchange.development.
 
Back
Top