Code not working on Access 2002

R

Randy

I have a command button on my [Incoming Notesheet] form with code to print a
report only from the current record. It has worked fine on Access 2000.
But when I installed the database on Access 2002 the code brought up the
report in design view and proceeded to print all the records in the database
in design view. The code I have obviously doesn't work for Access 2002. Can
any one help me with getting it to work. Here is my code which I copied
from the access newsgroups. Thank you very much...Randy

Private Sub Print_Field_Note_Click()
On Error GoTo Err_Print_Field_Note_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Dim strDocName As String
Dim strWhere As String

strDocName = "Inedible Notesheet"
strWhere = "[AnalysisID]=" & Me![AnalysisID]
DoCmd.OpenReport strDocName, acPreview, , strWhere
Dim stDocName As String

stDocName = "Inedible Notesheet"
DoCmd.OpenReport stDocName, acNormal

Exit_Print_Field_Note_Click:
Exit Sub

Err_Print_Field_Note_Click:
MsgBox Err.Description
Resume Exit_Print_Field_Note_Click

End Sub
 

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