Compile Error

K

KDG

VBA Novice here. Inherited DB. Developer is now in U.K. and unable to help.
Have a form that runs code to grab a .txt file and converts it to the format
for import to the DB (simplified explanation). It has worked in the past, but
now seems to have a problem. I am getting a "Compile Error: User-defined Type
Not Defined." I have been told that I possibly do not have the appropriate
library defined? I will include below the libraries that are checked for this
database and the beginning of the code in question. I thank anyone for any
suggestions that they may be able to offer. I'm in the dark! I moved the file
location. Could that be causing any problems? I wouldn't think so, but as I
said, I'm a novice. Thank you, thank you, thank you!

Libraries:
VBA
MS Access 12.0 Object Library
OLE Automation
MS DAO 3.6 Object Library
MS VBA Extensibility 5.3

Here's the first few lines of code. The first line pops up highlighted in
yellow in the debugger. The second line from "As New" on are highlighted in
blue, also.

Private Sub cmdRun_Click()
Dim cn As New ADODB.Connection
Dim rsData As New ADODB.Recordset
Dim sLine As String
Dim ictr As Long

Dim sMnu As String, sType As String, sNmbr As String
Dim iMonths(1 To 12) As Integer, iMonthData(1 To 13) As Long, sMonths(1
To 13) As String
Dim iYr(1 To 12) As Integer
Dim sPatType As String, sLabid As String
Dim lngPosition As Long, iPos As Integer, iAdd As Integer
Dim iPosCtr As Long, bPosTest As Boolean
Dim iAddCtr As Long, bAddTest As Boolean

On Error GoTo errHand
 
D

Douglas J. Steele

To be able to use ADODB objects, you need to add a reference to the
Microsoft ActiveX Data Objects 2.x Library. (In general, go with the highest
value for 2.x: probably 2.8)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top