. . . 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.
6 2129
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.
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.
@OldBirdman - The following code demos how you can dynamically create Controls on a Report:
- Dim rpt As Report
-
Dim ctlLabel As Control
-
Dim ctlText As Control
-
Dim intDataX As Integer
-
Dim intDataY As Integer
-
Dim intLabelX As Integer
-
Dim intLabelY As Integer
-
-
DoCmd.OpenReport "Report1", acViewDesign
-
-
Set rpt = Reports("Report1")
-
-
'Position Text Box and associated Label
-
intLabelX = 100
-
intLabelY = 100
-
intDataX = 1000
-
intDataY = 100
-
-
'Create 'Bound' ([LastName]) Default-size text box in Detail Section.
-
Set ctlText = CreateReportControl(rpt.Name, acTextBox, acDetail, "", _
-
"LastName", intDataX, intDataY)
-
-
'Create child label control for the Text Box.
-
Set ctlLabel = CreateReportControl(rpt.Name, acLabel, acDetail, _
-
ctlText.Name, "NewLabel", intLabelX, intLabelY)
-
-
DoCmd.Close acReport, "Report1", acSaveYes
- 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.
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)>
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
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |