473,654 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Docmd.OpenRepor t or DocmdRunReport (Available in access 2007 ??)

108 New Member
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 6060
robtyketto
108 New Member
I should add using DoCmd.RunReport "rptStudentClas sification" gave the message

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

DoCmd.OpenRepor t "rptStudentClas sification", acViewPreview

Indicating the report is fine.

Thanks
Rob
Feb 20 '08 #2
robtyketto
108 New Member
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,568 Recognized Expert Moderator MVP
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,568 Recognized Expert Moderator MVP
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
3862
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 following codes are written in the VB Applcation. - Prior to opening the report, I set its recordsource with a sql: ..Reports!rptABC.RecordSource = sSql. The sSql searches for a specific
2
3235
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 Access! No error message is given, the thing just vanishes! Why? How do I fix this?
1
2144
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 ("Microsoft Access for Windows has encountered a problem and needs to close. We are sorry for the inconvenience."). The reports themselves run fine when I double-click on them - it's only when I try to run them through code (including in the...
3
2735
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? I mean also OpenForm, OpenQuery etc. Thank you in advance for help Marcin
2
2815
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 find out the cause. Help Desk updated printer driver on server and no runtime error for two months but we are receiving it again on three computers. I think this might be specific to the actual mdb file and what occurs with references, dll's,...
3
7784
by: enough2Bdangerous | last post by:
access runtime error 3011 on docmd.openreport -------------------------------------------------------------------------------- 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 find out the cause. Help Desk updated printer driver on server and no runtime error for two months but we are receiving...
4
9468
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 using the existing query
3
6447
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 to access VBA. I'm using Access2003 Below is my code extract. The tblWelderQualification.Stamped field is a yes/no field, I want to show records that have a "TRUE" value when the checkbox on the form is ticked. When I run the code, I get the...
4
6658
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 entry fields and so there is a button you press which then takes to through to a print preview of the invoice and you print out the invoice but recent ly this message ahs started appearing and does not allow you to view the print preview of the invoice...
0
8815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8489
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8594
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1596
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.