473,399 Members | 3,038 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,399 software developers and data experts.

Docmd.OpenReport or DocmdRunReport (Available in access 2007 ??)

108 100+
Greetings,

I originally used a button on a from created via the button wizard (access 2007) to run my report which was based on a query.

Since I wanted to add some validation I removed the button and added my own
code (as below):-

However the open report is just a preview and the user cant exit the preview
screen without directly using access controls.

I cant use the DoCmd.RunReport method :-(

I want to create report output and then use buttons on the report output
allowing for more user navigation and functions.

How do I run reports and allow the screen to include the actual report
output with workable buttons etc.., as per available in the macros assigned using button wizard ?

Hope this makes sense.

Thanks Rob

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdopenreport_Enter()
  2.  
  3. On Error GoTo Report_NoData_Error
  4.  
  5. If IsNull(cboStudentid) Then
  6.         MsgBox "Please choose a student Id", vbCritical
  7.         cboStudentid.SetFocus
  8. Else
  9.     DoCmd.OpenReport "rptStudentClassification", acViewPreview
  10.    ' DoCmd.RunReport "rptStudentClassification"
  11. End If
  12.  
  13. Report_NoData_Exit:
  14. Exit Sub
  15.  
  16. Report_NoData_Error:
  17. If Err.Number = 2501 Then 'the report was cancelled
  18.     Exit Sub
  19. Else
  20.     MsgBox Err.Number & " - " & Err.Description
  21.     Resume Report_NoData_Exit
  22. End If
  23.  
  24.  
  25. End Sub 
Feb 20 '08 #1
4 6033
robtyketto
108 100+
I should add using DoCmd.RunReport "rptStudentClassification" gave the message

"Compile Error: Method or data member not found" though this code works:-

DoCmd.OpenReport "rptStudentClassification", acViewPreview

Indicating the report is fine.

Thanks
Rob
Feb 20 '08 #2
robtyketto
108 100+
Further clarification of problem:-

In access 2007 using the button wizard you can assign a report to run it
upon click event (macro).

Rather than seeing the preview window with magnifying glass you see the
report output.
Within the report layout you can add buttons to it and assign code.

The buttons on my report can be seen using openreport, but as its in preview
mode they cant be clicked.
Feb 20 '08 #3
NeoPa
32,556 Expert Mod 16PB
Let's start with a couple of simple things :
  1. DoCmd has no .RunReport method. It DOES have .RunCommand, .RunMacro and .RunSQL methods. It also has a .OpenReport method.
  2. Reports don't have clickable Command Buttons. They can exist, but are not clickable (Why? I don't know).
Perhaps #2 is not so simple then I suppose.
I can only guess that they are there as Reports and Forms share a lot of similarities. Maybe someone else knows better.
Feb 20 '08 #4
NeoPa
32,556 Expert Mod 16PB
It looks like what you're looking for is actually to run the selecting etc from a form before opening the Report. Example Filtering on a Form gives some help with this concept. It works mainly with Forms but the concepts are the same.
Feb 20 '08 #5

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

Similar topics

1
by: Andrew | last post by:
Hi All: I am using Access2000 and I find that the command to open an Access report in preview mode is very slow: DoCmd.OpenReport rptABC, acViewPreview, "", "" The scenario is this: - The...
2
by: Jonathan Goldman | last post by:
Hi- I have a relatively simple report that I open in an Access '97 VBA procedure, using the Docmd.OpenReport "rptName", acViewNormal syntax. The problem is that doing this usually crashes...
1
by: LoopyNZ | last post by:
Hi there, I've converted an Access 97 front end to Access 2000, but when I try to run a VBA DoCmd.OpenReport (e.g. DoCmd.OpenReport "rpt_programme_listing") line, Access completely crashes...
3
by: news.onet.pl | last post by:
Hello! I have a question concerning to open the reports. I know that DoCmd.OpenReport is a obsolete form of opening the reports, but how to implement opening reports in VB using another VB code?...
2
by: enough2Bdangerous | last post by:
Access database (file format 2002-2003) generates reports with docmd.openreport but returns 3011 runtime error related to the printer. Switching Windows default printer is a work around but need to...
3
by: enough2Bdangerous | last post by:
access runtime error 3011 on docmd.openreport -------------------------------------------------------------------------------- Access database (file format 2002-2003) generates reports with...
4
by: Simon | last post by:
Dear reader, The syntax for Docmd.OpenReport is: OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs) Example The following example prints Sales Report while...
3
by: russellhq | last post by:
Hi, i am trying to open a report based on values picked in a form but get stuck with one of the values. I have a feeling it has to do with the yes/no datatype but am not sure since I am quite new...
4
by: gazza10001 | last post by:
Hi i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.