Complie Error, What library am I missing? (1 Viewer)

alktrigger

Aimless Extraordinaire
Local time
Today, 07:26
Joined
Jun 9, 2009
Messages
124
I keep getting a "compile error: User Defined Type not defined" when I try to run a concacnation function. code being as follows, and when I go to debug it highlights the red line.

Code:
Public Function Conc(ID) As String
   ''the following was adapted from code was found at http://www.access-programmers.co.uk/forums/showthread.php?t=67164
   Dim cnn [COLOR=Red]As ADODB.Connection[/COLOR]
   Dim rs As New ADODB.Recordset
   Dim SQL As String
   Dim sConc As String
   Dim rs As Recordset
   Dim cnn As String
   
   Set cnn = CurrentProject.Connection

   SQL = "SELECT [Issue] FROM [sqyReportSummary] _&
        WHERE [ShipNum]=" & ID
   
   rs.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly
   Do While Not rs.EOF
     sConc = sConc & ", " & rs![Issue]
     If sConc = "," Then
        sConc = ""
     End If
     rs.MoveNext
   Loop
   sConc = Mid(sConc, 3)    'Remove leading comma and space.   
   Set rs = Nothing
   Set cnn = Nothing   
   Conc = sConc
   
End Function
I've enabled all the libraries I thought might solve the problem, but maybe I am looking at this the wrong way. Any suggestions would be greatly appreciated
 

DCrake

Remembered
Local time
Today, 12:26
Joined
Jun 8, 2005
Messages
8,626
Microsoft ADO Ext. n.n for DDL and Security.
Where n.n is the version number.
 

alktrigger

Aimless Extraordinaire
Local time
Today, 07:26
Joined
Jun 9, 2009
Messages
124
I have the following libraries enabled, and its still giving the same error on the same line.



EDIT: solved by adding ActiveX Data Objects 2.8 Library
 
Last edited:

Users who are viewing this thread

Top Bottom