473,405 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Error 2497 (Report Name argument)

When I try to run the sub procedure by clicking by command button "cmdPreview," this error occurs:

Run-time error '2497':
The action or method require a Report Name argument.

I've transcribed the following code straight from a book from which I'm being taught, and to the best of my knowledge, it's been copied character for character:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private strReport As String
  4. Private Sub cmdPreview_Click()
  5. Dim strSQL As String
  6. Dim strWhere As String
  7. If Not IsNull(txtDistributor) Then
  8.    strWhere = strWhere & " AND DistributorName Like " & "'" & txtDistributor & "*'"
  9. End If
  10. If Not IsNull(txtContact) Then
  11.    strWhere = strWhere & " AND ContactName Like " & "'" & txtContact & "*'"
  12. End If
  13. If Not IsNull(strWhere) Then
  14.     strSQL = Mid$(strWhere, 6)
  15. End If
  16.  
  17. DoCmd.OpenReport strReport, acViewPreview, , strSQL
  18. 'Set the option group, combo boxes, and check box back to null
  19. Clear_Controls:
  20.     grpReports = Null
  21.     txtDistributor = Null
  22.     txtContact = Null
  23. End Sub
  24. Private Sub grpReports_AfterUpdate()
  25. Select Case grpReports
  26.   Case 1
  27.    strReport = "rptVisitorsByDistributor"
  28. End Select
  29. End Sub
  30.  
  31.  
The part in bold is the line that apparently has the problem. The report name argument "strReport" is a string variable that was declared at the beginning of the code, and in the Private Sub at the bottom, strReport is supposed to be set to the value of the report name that is to be opened.

I'm relatively new to VBA (and programming in general), so any help would be great!
Apr 27 '10 #1
1 2318
Not sure what I did, but I got it to work. Something to do with the AfterUpdate event of the Option Group "grpReports" I think, but I'm not sure... but if it works, I won't question it.
Apr 28 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: News Central | last post by:
To all! I use the DateDiff function using VB6 and get this error 'Wrong number of argument or invalid property assignment' ... have anyone seen this problem? thanks ....
1
by: Jasper Recto | last post by:
I have a little program that opens a progress database and runs a report. Dim Path As Object Dim Report As Object Path = "d:\ReportBuilder\VendorShipping.p" Report =...
1
by: timVerizon | last post by:
Hoping someone can help here.. Our application (C#.Net) was receiving IBM.Data.DB2.DB2Exceptions ERROR SQL0904N Unsuccessful execution caused by an unavailable resource. Reason code: '', type...
1
by: Doug | last post by:
I am sending out snapshot reports and I would like to change the name given to that particular snapshot report to include a date range instead of just the report name. Is there a way to add...
1
by: CQ | last post by:
I have a module that appends a table with a report name when that report is run. The problem that I am having is that I don't know how to get and pass the report name to a variable. Right now, I...
1
by: Harshil | last post by:
Hi All, I am working on Vb.net application with oracle as my database. I have developed reports using crystal report 9. Usually when you open reports directly in crystal report viewer control it...
2
by: mike_li | last post by:
On Window 2000 Professional Server DB2 UDB Level: DB2 code release "SQL07029" with level identifie "030A0105" and informational tokens "DB2 v7.1.0.98", "n040510" and "WR21337". In the...
4
by: lorirobn | last post by:
Hi, I have a main menu that opens several different reports. I am adding an OrderByOn, and currently have it set up for one report with the following statements: !.OrderBy = strOrderBy...
12
by: Orchid | last post by:
Hello all, I have different version of reports which used for different months. For example, I am using report version 1 up to September, but we have some design changes on the report for October,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.