ADODB.Recordset error in Access 2007 (1 Viewer)

Colt45

Registered User.
Local time
Today, 07:23
Joined
Jul 21, 2010
Messages
13
Hi all,
I hope someone can help. I use an ADO function to sort and rank a table which worked fine in my old Access 2003 setup. I now have a new machine and I've upgraded to Access 2007 and I'm finding the function doesn't work.

My suspicion is that I'm missing an ADO reference, but don't know and can't find how to set it in Access 2007 (e.g. my add-in manager is greyed out)

When I run the function I get the error "Compile Error: User-defined type not defined" on the bold line below, which is shown in the extract from the function below.


Public Function SalesMfgDescRank(strSalesRankType As String)
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection
Dim lngSalesRank As Long
Dim ssql As String
Dim strCurrentSKU As String
Dim strCheckSameSKU As String
Dim lngCurrentRow As Long
' Set Connections but do not open them yet
Set rs = New ADODB.Recordset
Set conn = CurrentProject.Connection
rs.ActiveConnection = conn
'Must set cursor location to be adUseClient to be able to sort the table
rs.CursorLocation = adUseClient

Thanks,
Henry
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 16:23
Joined
Jan 20, 2009
Messages
12,851
References are not in the Add-in manager.

Open the VBA editor. Tools / References
 

Aleni

Registered User.
Local time
Yesterday, 23:23
Joined
Dec 6, 2012
Messages
45
Go to
Tools - Reference -Tick Microsoft ActiveX Data Objects 2.8 library

It will work perfectly.
:)
 

Colt45

Registered User.
Local time
Today, 07:23
Joined
Jul 21, 2010
Messages
13
Thanks guys, and sorry for the late reply. This helped me out.
 

Users who are viewing this thread

Top Bottom