Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2006, 12:24 PM
Registered User
 
Join Date: Apr 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default error when I add print button for printing a repor

I add a printing button in a form to print the related field in a report. I add VAB code shows below:

    Dim stDocName As String
    Dim strFilter As String

    stDocName = "RPT Order"

    strFilter = "OrderID = Forms![FRM Order New]!OrderID"
    DoCmd.OpenReport strDocName, acViewNormal, , strFilter
but when I clink on printing button, it give me "The action or method requires a report name argument"
I have no ideal about that. can someone help me? Thanks

 
Old July 20th, 2006, 12:44 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

It looks like the name of the variable you are using is different stDocName and strDocName. Changing one should fix your problem.

A really good way of avoiding problems like this is to put Option Explicit at the top of the code module. This forces you to declare all variables before you can use them. It has saved me a bunch of headaches, and helps your code be better structured.

HTH

Mike

Mike
EchoVue.com
 
Old July 20th, 2006, 12:47 PM
Registered User
 
Join Date: Apr 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm so careless. I solve the problem. thans a lot!

 
Old July 20th, 2006, 01:04 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

No worries - That Option Explicit helps out a lot, and sometimes you just need a fresh pair of eyes to look at it.

Mike

Mike
EchoVue.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing fit to page print arnabghosh Javascript How-To 2 July 29th, 2007 05:58 PM
get copies of document to print in System.Printing motconduong Windows Presentation Foundation 0 June 30th, 2007 11:08 AM
Add Push button or Check Box in outlook add-ins capdevs VS.NET 2002/2003 0 January 7th, 2006 08:51 AM
'print' button crmpicco Classic ASP Basics 0 February 8th, 2005 10:25 AM
Print web page withiout printing url footer rekha_jsr Classic ASP Basics 4 September 15th, 2004 10:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.