ACC2000: Cannot Open Report in a Microsoft Access Project (243532)
The information in this article applies to:
This article was previously published under Q243532 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access project (.adp).
SYMPTOMS
When you open a report in a Microsoft Access project, you may receive the following error message:
The recordsource recordsource specified on this form or report does not exist.
However the table, view, or stored procedure that the report is based on does exist in the database that the Access project is connected to and is spelled correctly.
CAUSE
The object specified in the RecordSource property of the report does not include the owner's user account name in the object identifier, and the user attempting to open the report is not the object owner.
RESOLUTION
Always specify the user name of the owner of the object when you provide an object name for the RecordSource property. For example, instead of typing MyTable in the RecordSource property, type dbo.MyTable.
You can use the following subroutine to update all existing forms and reports. Note This code assumes the owner is not already specified in the RecordSource property and all objects have the same owner. Sub AddOwnerPrefix()
Dim x As Object
Dim strOwner As String
strOwner = "dbo."
'Change the RecordSource property for all forms.
For Each x In CurrentProject.AllForms
DoCmd.OpenForm x.Name, acDesign, , , acFormPropertySettings, acHidden
Forms(x.Name).RecordSource = strOwner & Forms(x.Name).RecordSource
DoCmd.Close acForm, x.Name, acSaveYes
Next x
'Change the RecordSource property for all reports.
For Each x In CurrentProject.AllReports
DoCmd.OpenReport x.Name, acViewDesign
Reports(x.Name).RecordSource = strOwner & Reports(x.Name).RecordSource
DoCmd.Close acReport, x.Name, acSaveYes
Next x
MsgBox "Finished updating all forms and reports."
End Sub STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 1/26/2005 |
---|
Keywords: | kbbug KbClientServer kbpending KB243532 |
---|
|