Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reports Menu

Status
Not open for further replies.

bdm1

Programmer
Feb 4, 2002
75
US
Working in Access 2007. I have a form with an unbound text box which populates reports via a query:

SELECT MsysObjects.Name, MsysObjects.Type
FROM MsysObjects
WHERE (((MsysObjects.Type)=-32764) AND ((Left$([Name],1)) Not Like "x*"))
ORDER BY MsysObjects.Name;


The users can choose a report to view by double clicking on it. This is the event:

Private Sub lstReports_DblClick(Cancel As Integer)
DoCmd.OpenReport Me.lstReports, acViewPreview, acViewNormal
DoCmd.Close acForm, "Reports Menu"
End Sub

When this event is triggered, an error message:

“ Database engine could not find object ‘0’”

Can’t figure out what is happening. Help much appreciated…

BDM
 
Have you verified Me.lstreports has a report name in it?

I'd put a break point on the openreport line and in the debug window copy that line and replace me.lstreports with the literal report name. If that works there is something funky with the recordsource, perhaps wrapping it with a simple trim might fix it.

I don't ever query out of system tables especially for applications as you never know when MS may change things.
Instead I use a table where I list my reports complete with object name and the value I want the user to see.
 
The text box does populate with all the reports. The error occurs when a report is selected. I have used this procedure in the past, although in prior versions of Access, with no problems. Am thinking that this may be some quirk in 2007. Am still trying to get used to this version.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top