How do I open the Relationships report in Access using VB code?

G

Guest

I have created a command button which I want to use to open the Relationships
report. I had been supplied some code shown below but it is not working.

Private Sub cmdApplicationDataModel_Click()
On Error GoTo errHandler
DoCmd.Echo False, ""
DoCmd.OpenReport "rptRelationship", acViewPreview
DoCmd.Maximize
DoCmd.Echo True, ""
errHandler:
DoCmd.Echo True
Exit Sub
End Sub
 
A

Allen Browne

If you saved the relationship report with the name rptRelationship, you can
open it with:
DoCmd.OpenReport "rptRelationship", acViewPreview

If you do not have a relationship report saved, you can open the
Relationships window in Access 2002 and later like this:
RunCommand acCmdRelationships
RunCommand acCmdPrintRelationships

In Access 2000, you can do it with:
RunCommand acCmdRelationships
SendKeys "%FR", True
 

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