alktrigger
Aimless Extraordinaire
- Local time
- Today, 07:17
- Joined
- Jun 9, 2009
- Messages
- 124
Access 2007
I am busy adapting the code found in http://www.access-programmers.co.uk/forums/showthread.php?t=67164 but when I copy it to my database it crashes when it get to "Dim cnn As ADODB.connection". What is going wrong, It works when I run the sample database, but when I copy or even import the module, it puts access into an infinite error loop.
Thanks ahead of time for the help
I am busy adapting the code found in http://www.access-programmers.co.uk/forums/showthread.php?t=67164 but when I copy it to my database it crashes when it get to "Dim cnn As ADODB.connection". What is going wrong, It works when I run the sample database, but when I copy or even import the module, it puts access into an infinite error loop.
Code:
Public Function Conc(ID) As String
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim SQL As String
Dim sConc As String
Set cnn = CurrentProject.Connection
' SQL = "SELECT [Name] FROM [tblData] WHERE [Date]=#" & ID & "#"
SQL = "SELECT [Name] FROM [tblData] WHERE [MeetingID]=" & ID
rs.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly
Do While Not rs.EOF
sConc = sConc & ", " & rs![Name]
rs.MoveNext
Loop
sConc = Mid(sConc, 3) 'Remove leading comma and space.
Set rs = Nothing
Set cnn = Nothing
Conc = sConc
End Function
Thanks ahead of time for the help