Reports in List Box

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Thanks. This got me pass the original error, but now I am
getting an "Item not found in this collection" error and
the "if !rptListName = rptReportsMenu.Value Then" line is
highlighted.

What am I doing wrong? Did I mention that my VBA skills
are weak at best :o)

Thanks again for your time AND patience.
-----Original Message-----
Mike:

1.) If you are getting that error, then your database is not using ADO as
its data access method, rather it is using DAO. (You can check this by
going to Tools->References when in a module and looking at the reference
items. If Microsoft Data Access Objects is listed then you're using DAO.
To fix the code then change these lines:

Dim conn As ADODB.Connection

To:

Dim db as DAO.Database
Dim rstReportList as DAO.Recordset
Set db = CurrentDb()
Set rstReportList = db.OpenRecordset("tblReportList", dbOpensnapshot)

2.) That said, I'm not sure why in the double click code the first responder
provided, they even look to the table to see if the report is listed. If
the list box is populated based on the table in the first place, then the
darn report should be there, all you need is

If Len(Me!rptListName)>0 Then _
DoCmd.OpenReport Me!rptListName, acViewPreview
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg




.
..
 
"if !rptListName" isn't valid -- if it is in the Form's module, it could be
"if Me!rptListName" or "if Forms!<yourformsname>!rptListName". If it is
outside that particular Form's module, only the latter, fully-qualified
version will do.

Now, it could be that was just a typo; if so, follow up here and maybe
someone can suggest a next step.

Larry Linson
Microsoft Access MVP
 
Back
Top