Compile Error Adodb.recordset
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ADO Execution - compile error: User-defined type not defined up vote 1 down vote favorite I have the following ado connection from excel to access but it does not work, am getting the error above. Any ideas? Sub ADO_to_access() Dim database As New ADODB.Connection // ERROR HERE Dim connectionstring As String Dim NewSet As Recordset Dim CurrentSheet As Worksheet Set CurrentSheet = ActiveSheet Set objaccess = Nothing connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=C:\Users\Carlos\Desktop\VBA - CW - Database.mdb;" database.Open connectionstring ' ************* MEN Set NewSet = New ADODB.Recordset NewSet.Open "Mens_Dept_Data", database, adOpenKeyset, adLockOptimistic, adCmdTable x = 6 Do While Len(Range("P" & x).Formula) > 0 With NewSet .AddNew .Fields("Irina").Value = CurrentSheet.Range("P" & x).Value .Fields("Thomas").Value = CurrentSheet.Range("Q" & x).Value .Fields("Jackie").Value = CurrentSheet.Range("R" & x).Value .Update End With x = x + 1 Loop NewSet.Close database.Close End Sub ms-access vba excel-vba ado jet share|improve this question edited Apr 11 '12 at 13:51 Joel Coehoorn 248k92440661 asked Nov 19 '10 at 14:27 Carlos 3,1201250101 by the way, there is a bug in the code formatting on SO. To avoid it, "close" the comment with a ' at then end of your comments :-/ –iDevlop Nov 19 '10 at 14:41 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote accepted Did you reference the adodb library ? (From VBE, select Tools, References) share|improve this answer answered Nov 19 '10 at 14:31 iDevlop 14.4k44187 no i did not, which do I have to choose? –Carlos Nov 19 '10 at 14:34 1 Microsoft ADO ext 6.0 for DDL and Security? –Carlos Nov 19 '10 at 14:37 1 Microsoft ActiveX Data Objects x.x There are often many of them. Choose the one you need, if you don't know, select the most recent. –iDevlop Nov 19 '
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is http://stackoverflow.com/questions/4225931/ado-execution-compile-error-user-defined-type-not-defined a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Access 2010 compile error User-defined type not defined up vote 1 down vote favorite I converted a 2003 database to 2010 and VBA scripting created in 2003 is not working in 2010. http://stackoverflow.com/questions/11889833/access-2010-compile-error-user-defined-type-not-defined I am getting the message that there is a Complie Error - User-defined type not defined. I do not have experience with VBA scripting and I did not create the script but understand that action that it is completing within the database. The specific item it highlights is the DIM adoConn As New ADODB.Connection. I am including the script any assistance will be beneficial as the action that is performed is a great asset to our workflow. Private Sub Error_code_exit(Cancel As Integer) On Error GoTo Error_code_exit Dim strSQLErrorCode As String Dim adoConn As New ADODB.Connection Dim adoRSErrorCode As New ADODB.Recordset Set adoConn = CurrentProject.Connection strSQLErrorCode = "SELECT [Error Matrix1].[Error Code], [Error Matrix1].CTC FROM [Error Matrix1];" adoRSErrorCode.Open strSQLErrorCode, adoConn, adOpenKeyset, adLockOptimistic If Not adoRSErrorCode.EOF Then Do If adoRSErrorCode.Fields("Error Code") = Me.Error_Code.Value Then If IsNull(adoRSErrorCode.Fields("CTC")) Then Me.chkAgree = True Exit Do End If End If adoRSErrorCode.MoveNext Loop Until adoRSErrorCode.EOF End If adoRSErrorCode.Close adoConn.Close Exit_code_exit: Exit Sub Error_code_exit:
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 06 Oct 2016 00:37:12 GMT by s_hv1000 (squid/3.5.20)
Unanswered Topics Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA ADODB.Connection user-defined type not defined User Name Remember Me? Password Reminder Password Register Register | FAQ | Members List | Calendar | Today's Posts | Search Excel VBA Discuss using VBA for Excel programming. Search Forums Show Threads Show Posts Advanced Search Find All Thanked Posts Go to Page... Welcome to the p2p.wrox.com Forums. You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free . Thread Tools Display Modes #1 (permalink) February 28th, 2006, 12:50 AM Wall st Guru Authorized User Join Date: Jun 2004 Location: , , . Posts: 13 Thanks: 0 Thanked 0 Times in 0 Posts ADODB.Connection user-defined type not defined When I type Dim cnn As ADODB.Connection to connect to another excel from within excel I get the error user-defined type not defined I would appreciate if someone could help me on this. Thanks #2 (permalink) February 28th, 2006, 03:09 AM maccas Friend of Wrox Join Date: Jun 2003 Location: London, , United Kingdom. Posts: 173 Thanks: 0 Thanked 3 Times in 3 Posts You need to set a reference to "Microsfot ActiveX Data Objects" (ADO for short) first. In the VBE select Tools -> References... From the dialog box that pops up, scrolll down until you find an entry that reads something like Microsfot ActiveX Data Objects 2.7 Library (the number might be different - pick the highest number you can see). Check the tick box next to this entry and then click ok. You should be good to go now. Maccas #3 (permalink) March 26th, 2014, 03:44 PM ravineon Registered User Points: 3, Level: 1 Activity: 0% Join Date: Mar 2014 Posts: 1 Thanks: 0 Thanked 0 Times in 0 Posts Thank you