473,387 Members | 1,548 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,387 software developers and data experts.

Controls on a Report

675 512MB
. . . apply only to forms and controls on a form, not controls on a report.
How do I put controls on a Report. Any attempt to do so has the 'Event' tab of the properties as blank.

If I can't have an event, it isn't a command button. It is a picture of a command button.
Mar 9 '09 #1
6 2129
maxamis4
295 Expert 100+
First you have to understand that reports are not forms. You can't just tell a report to run a function and it does it for you. A report is the output of something you created (obviously), but more importantly the report by the time you create is pretty much compilied. In reports however you still have event handlers like, On Open, On Load, and couple more I can't think of right now. Those are your event handlers if you still want to add any sort of constraint or code generated formatting. A good example of this is using a On Open event to prompt you for a date range using a form. This will allow and limit the report to a specific date criteria.

http://www.mvps.org/access/reports/index.html

Give that a look and see if it helps.
Mar 9 '09 #2
OldBirdman
675 512MB
For years, I've seen the quote
. . . apply only to forms and controls on a form, not controls on a report.
in Access Help. I found it again today on KeyDown, KeyUp Events. I was just curious why Help would continually tell me what I could and could not do with controls on a Report, if I couldn't put controls on a Report anyway.
I do understand that events can occur for the Report, Open, Close, Activate, Page, NoData. When I am free of development, and don't have the Access Toolbars/Menus, how do I switch from Preview to Print?
A good example of this is using a On Open event to prompt you for a date range using a form. This will allow and limit the report to a specific date criteria.
My personal programming style is to have ALL options covered before getting to the Report Load Event, and not to have a button that says "Print", that doesn't print, but asks for more information.
Mar 9 '09 #3
ADezii
8,834 Expert 8TB
@OldBirdman
  1. The following code demos how you can dynamically create Controls on a Report:
    Expand|Select|Wrap|Line Numbers
    1. Dim rpt As Report
    2. Dim ctlLabel As Control
    3. Dim ctlText As Control
    4. Dim intDataX As Integer
    5. Dim intDataY As Integer
    6. Dim intLabelX As Integer
    7. Dim intLabelY As Integer
    8.  
    9. DoCmd.OpenReport "Report1", acViewDesign
    10.  
    11. Set rpt = Reports("Report1")
    12.  
    13. 'Position Text Box and associated Label
    14. intLabelX = 100
    15. intLabelY = 100
    16. intDataX = 1000
    17. intDataY = 100
    18.  
    19. 'Create 'Bound' ([LastName]) Default-size text box in Detail Section.
    20. Set ctlText = CreateReportControl(rpt.Name, acTextBox, acDetail, "", _
    21.                                   "LastName", intDataX, intDataY)
    22.  
    23. 'Create child label control for the Text Box.
    24. Set ctlLabel = CreateReportControl(rpt.Name, acLabel, acDetail, _
    25.                ctlText.Name, "NewLabel", intLabelX, intLabelY)
    26.  
    27. DoCmd.Close acReport, "Report1", acSaveYes
  2. You can create Event Procedures in a Form, Report, Controls on a Report, Form and Report Sections, but to the best of my knowledge you cannot create Event Procedures for Controls on a Report itself. To create Event Procedures, use the CreateEventProc() Method. This Method if easy enough to use and is documented in the Help Files.
Mar 10 '09 #4
missinglinq
3,532 Expert 2GB
I was just curious why Help would continually tell me what I could and could not do with controls on a Report, if I couldn't put controls on a Report anyway.
Who said you couldn't put Controls on Report? Of course you can put Controls on Reports. The Controls simply don't have the same Events available! You can't enter or exit a Textbox on a Report, obviously, or click on a Radio Button, or do a lot of thing you can on a Form.

Amazingly, I understand that in version 2007 you can place a Command Button that does have a OnClick Event! Most curious!

Linq ;0)>
Mar 10 '09 #5
mshmyob
904 Expert 512MB
You are quite correct about being able to put command buttons and OnClick even mouse events, focus events, etc in AC2007. I have used it multiple times now and it works just fine.

cheers,

@missinglinq
Mar 10 '09 #6
OldBirdman
675 512MB
Somehow, I had it in my head that controls, at least when talked about in Help in conjunction with KeyDown, Click, etc. were things that could be manipulated.

My bad. Of course controls are all the textboxes on the report. And of course they cannot have events associated with them. I just had my mind set funny, and I needed the kink of kick you gave me. Thank you for your time.
Mar 11 '09 #7

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

Similar topics

3
by: Steven Stewart | last post by:
Hi there, I have a report that is opened from a command button on a form. There is a label on the report called lblProvince. I would like to be able to change that label based on what the user...
1
by: Stinky Pete | last post by:
Hi, I've got a sub report that has been set to print down then across as the data is sorted in date order. This sub report displays and prints as per my design when dealt with as a stand alone...
5
by: CSDunn | last post by:
Hello, I have ‘Snap to Grid' turned off when I am working in the Design View of either a form or report. However, it only seems to be off when I use the mouse. If I try to move controls with...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
4
by: John Tyce | last post by:
The problem that I am now having, involves refreshing controls. I have allot of text boxes, several combo boxes and grids. These controls are showing live data from an Oracle database. I have dates...
3
by: fauxanadu | last post by:
I have a report called rptFilter. In my frmPrint Form, I have four option controls that allow for selection of specific criteria to contol what appears in the report. I also have two text boxes...
1
by: Peter Herath | last post by:
I have created a report using sample codes taken by the forum. one problem is that the report displays the field/column names in the table in columnar format(field names display in rows.) but i want...
4
by: Trish | last post by:
Hello All and thanks in advance for your help. The code below works just fine in the Print event of the report Detail section. Is it possible to condense it using a loop or something? Can you...
5
by: ofilha | last post by:
I have created a report in design mode. However, some of the fields i need are dynamic. That is, i have a series of fields text boxes mostly that must show up only as needed. I also have some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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
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...

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.