Compile error - User defined type not defined

C

ChuckW

Hi,

I copied some forms, queries, and reports from one access
database to another. When I go to run the report in the
new access database, I get a compile error - User defined
type not defined. I don't know too much VBA. Someone
actually wrote the vba for me that helps run this
report. The error highlights the "Private Sub
cmdReport_Click()" line in yellow and the highlights in
blue the next line which is "Dim qdf as DAO.Query.Def".
Can someone help me with this?

Thanks,

Chuck

Here are the first few lines of the VBA code:

Option Compare Database
Option Explicit

Private Sub cmdReport_Click()
Dim qdf As DAO.QueryDef
Dim db As DAO.Database
Dim varItem As Variant
Dim StrWhere As String
 
M

Marshall Barton

ChuckW said:
I copied some forms, queries, and reports from one access
database to another. When I go to run the report in the
new access database, I get a compile error - User defined
type not defined. I don't know too much VBA. Someone
actually wrote the vba for me that helps run this
report. The error highlights the "Private Sub
cmdReport_Click()" line in yellow and the highlights in
blue the next line which is "Dim qdf as DAO.Query.Def".
Can someone help me with this?


Go back to the original database and make a note of each
library in the list of checked references (VB Editor - Tools
menu). Then fix the list of checked references in the new
databse to match.
 

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