Compile Error when transfering form from one application to anothe

G

Guest

Hi,

I have a database that someone else created. In it is a form with a list
box that allows someone to click on a couple of products and then run a
report. The report gives a listing and detailed description of these
products. I am attempting to transfer this information from one database to
another. I have exported everything including the form, report, queres and
table. When I run it in my new database I get a compile error. Below are
the first few lines of code. I don't know much about VBA code. The compile
error highlights the four line 'Dim qdf As DAO.QueryDef. Can someone help
with this? Perhaps there is something I need to define or something I forgot
to import.

Thanks,

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
'You could delete and recreate the query each time,
'I generally leave the query and just modify the SQL
'On Error Resume Next
'db.QueryDefs.Delete ("tmpSelectProducts")
'On Error GoTo Proc_err
Set db = CurrentDb()
Set qdf = db.QueryDefs("tmpSelectProducts")
For Each varItem In Me.List0.ItemsSelected
StrWhere = StrWhere & "ProductName=""" & _
Me.List0.ItemData(varItem) & """ OR "
Next varItem
 

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