alktrigger
Aimless Extraordinaire
- Local time
- Today, 14:30
- 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.
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
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