Question : Access 2007 slow to link to Oracle database

Oh wisdomed Access Guru's on high,
I have some code which refreshes its tables links to an oracle database.  For some reason it takes a very long time (3 to 5 minutes) to complete one or two connections and I'm wondering if anyone could take a look at my code to suggest a change or a tweak?

Many thanks

Ted
 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
Public Function fncRelink() as long
'function to relink oracle tables to the database
On Error GoTo Err_Handler
fncRelink = 0
Dim CLink As String
CLink = "ODBC;DSN=ADSN;Password=MyPassword;DBQ=ADSN ;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;"
Dim td As DAO.TableDef
For Each td In CurrentDb.TableDefs
  If (Len(td.Connect) > 0) Then
     Debug.Print "Relinking Table: " & td.Name
     td.Connect = CLink
     td.RefreshLink
  End If
Next

Debug.Print "Relink Completed."

Quit_Handler:
Exit Function

Err_Handler:
    MsgBox Err.Description, vbInformation, "ReLink"
    Err.Number = 0
    Resume Quit_Handler
End Function

Answer : Access 2007 slow to link to Oracle database

tthe script runs through AD, get all distribution groups and for each one create separate worksheet in excel and list their members.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
Option Explicit

Dim adoCommand, adoConnection, strBase, strFilter, strAttributes
Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strName,groupType,groupName,iRow
Dim objExcel,arrMembers, strMember

' Setup ADO objects.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection

' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"

' Filter on distribution groups.
strFilter = "(objectCategory=group)"

' Comma delimited list of attribute values to retrieve.
strAttributes = "distinguishedName,member,groupType,name"

' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False

' Run the query.
Set adoRecordset = adoCommand.Execute

Set objExcel = CreateObject("Excel.Application")
With objExcel
.SheetsInNewWorkbook = 1
.Workbooks.Add
.Visible = True

' Enumerate the resulting recordset.
Do Until adoRecordset.EOF
' Retrieve values and display.
strName = adoRecordset.Fields("distinguishedName").Value
groupType  = adoRecordset.Fields("groupType").Value
groupName  = Replace(adoRecordset.Fields("name").Value,"CN=", "")

'get only distribution groups
if groupType=2 or groupType=4 or groupType=8 then
	irow=1
	.ActiveWorkbook.Worksheets.Add
	.ActiveSheet.Name= groupName
	arrMembers = adoRecordset.Fields("member").Value

	Wscript.Echo "Distribution Group: " & strName
	If IsNull(arrMembers) Then
		Wscript.Echo "-- <No Members>"
	Else
		For Each strMember In arrMembers
			Wscript.Echo "-- " & strMember
			Set objRootDSE = GetObject("LDAP://"&strMember)
			.Cells(iRow,1) = Replace(objRootDSE.Name,"CN=", "")
			irow=irow + 1
		Next
	End If
End If
' Move to the next record in the recordset.
adoRecordset.MoveNext
Loop
.Columns(1).entirecolumn.autofit
End With

' Clean up.
adoRecordset.Close
adoConnection.Close
Set objExcel = Nothing
Random Solutions  
 
programming4us programming4us