Help --> Compile Error - User defined type not defined

Help --> Compile Error - User defined type not defined

Post by RmF0TWF » Sat, 07 Feb 2009 01:49:45


Hello all:
I am wondering if anyone can help me the the follownig error:

Compile Error
User - defined type not defined

I get his error when I run my program and it stops on the following line of
code....

Dim Db As DAO.Database

The line of code is part of a procedure used to delete a table from a
different database. The full code is listsed below.

If anyone could please let me know what I am doing wrong I would greatly
appreciated it. Database and Code was created in Access 2000.

Thanks,
FatMan


Full Code....

Public Sub DeleteForeignData()

On Error GoTo Err_Handler
Dim Db As DAO.Database
Set Db = OpenDatabase("C:\Program Files\OCR Canada\OCRInv.mdb")

Db.Execute "Delete * from CollectedBatchData", dbFailOnError


Exit_Sub:
Db.Close
Set Db = Nothing
Exit Sub
Err_Handler:
MsgBox "Error #: " & Err.Number & " " & Err.Description
Resume Exit_Sub
End Sub
 
 
 

Help --> Compile Error - User defined type not defined

Post by fred » Sat, 07 Feb 2009 02:19:47


Sounds like a missing reference (or no reference to the DAO library).

Open any module in Design view (or click Ctrl + G).
On the Tools menu, click References.
Click to clear the check box for the type library or object library
marked as "Missing:."
Make sure there is a reference set to the Microsoft DAO 3.6 object
library!

An alternative to removing the reference is to restore the referenced
file to the path specified in the References dialog box. If the
referenced file is in a new location, clear the "Missing:" reference
and create a new reference to the file in its new folder.

For even more information, see
http://www.yqcomputer.com/
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
 
 

Help --> Compile Error - User defined type not defined

Post by RmF0TWF » Sat, 07 Feb 2009 03:25:41

Fred:
Thanks. You were bang on.

FatMan