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

creating controls:text boxes, labels on a report on the fly, runtime.

11
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 labels that also should dynamic depending on the text boxes. I first tried createReportcontrol during the OnOpen event for the report,and when i tried to run it, it would give me an error 2147, that i must be in design view in order to create or delete controls. Someone in google said that one way to avoid this would be to make the call to CreateReportControl from another form, before calling the docmd.open report command. I tried that and i got another error, 2451, that i cannot create a control on an unopened report. Then someone in google was saying that's not a good idea anyway. And instead to create enough controls and just making visible as i need them. I can do that, however, i still need to have the labels created dynamically because the labels refer to types of text boxes and i need to present them as i need them. Is there a way to create label controls on the fly for a report? And is there another call besides createreportcontrol or createcontrol that i can use?
Nov 14 '08 #1
5 7739
FishVal
2,653 Expert 2GB
Hello,

You may look at Create Dynamic Report using VBA.

On the other hand changing report controls visibility may be a better solution:
Hide no data fields in access reports
"Moving" a line in a Report based on 2 conditions

Regards,
Fish
Nov 14 '08 #2
ofilha
11
Thanks. I will look at those posts.
Nov 14 '08 #3
ofilha
11
I am trying this:
for each c in me.controls
if typeOf C is textbox then
me.controls(c.tag).visible = true
me.controls(c.tag).setfocus //it crashes
Me.lblMoneyOrder.top = me.txppay1.top
endif
next
I get the run-time error 2478 indicating that the application does not allow you to use this method in the current view.

I am trying to load data to the text boxes based on some criteria. I wanted to create the textboxes on the fly but i kept getting errors such as 2147 that does not allow me to create a control on a report unless it is a design view.

How can i set the focus on a report control on the fly?
Nov 14 '08 #4
missinglinq
3,532 Expert 2GB
I am trying this:

for each c in me.controls
if typeOf C is textbox then
me.controls(c.tag).visible = true
me.controls(c.tag).setfocus //it crashes
Me.lblMoneyOrder.top = me.txppay1.top
endif
next

How can i set the focus on a report control on the fly?
Trying this code WHERE?

To my knowledge, you cannot set focus to a control in a report, no matter what view it's in, nor can you use SetFocus in Design View on a form.

I get the run-time error 2478 indicating that the application does not allow you to use this method in the current view.

I am trying to load data to the text boxes based on some criteria. I wanted to create the textboxes on the fly but i kept getting errors such as 2147 that does not allow me to create a control on a report unless it is a design view.
You cannot create controls in Access, whether on a form or on a report, unless that form or report is opened in Design View! This is not going to change, no matter how mant times you try to do it.

To be honest, I think the best piece of advice you've gotten was from the person who told you that this wasn't a good idea. I personally consider it to be a horrendously bad idea. Trying to design and balance a report so that it presents data in a clear and professional manner is hard enough with the Design View in front of you. Trying to do it "on the fly" is really inane. You really need to think about designing your form in advance and, as has been suggested both here and elsewhere, making controls visible/invisible depending on your needs.

Welcome to Bytes!

Linq ;0)>
Nov 14 '08 #5
ofilha
11
Well, Right you are. I finally realized that and have now just created a bunch of controls i need and just turn them on and off (visible) as i wish. I found a solution in this site for my problem of moving the labels to the required positions on the fly. But what i was hoping to do was to create a variable but limited number of text boxes depending on the requirements. Thanks.
Nov 15 '08 #6

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

Similar topics

2
by: Chris Curtis | last post by:
We have a program which is used to upload data to our website. A report file is saved each time and is supposed to reflect the date! Not being a java programmer I think the following code is used...
1
by: nader | last post by:
hello what is the code to creating text compose many cells almost like excel program to or how do that and thankyou for all :?: Posted Via Usenet.com Premium Usenet Newsgroup Services...
0
by: Dylan | last post by:
I need to create some runtime controls in a TabControl I've tried doing the following but no controls appear txtBox = New TextBo tabCtrl.TabPages.Item(2).Controls.Add(txtBox) ' 2 being the...
3
by: Barrett | last post by:
Hello, basically I want to be able to determine the height of a panel at runtime on a webform. The only value I can squeeze out of the control properties is the height that is set at design time....
2
by: Andrea | last post by:
I'm having some difficulty creating a report in Access and I need some suggestions. My company issues "Return Authorizations" when customers need to return products. A customer calls in and we...
1
by: rp | last post by:
Hi, How would I create runtime tabpages with runtime controls(textBoxes,comboBox, checkedListBox), inserting,deleting, and modifing the tabpages whenever I want to in C#? Thanks in advance. rp
2
by: Steve | last post by:
This is a weird one. I have a series of "SmartParts" which are CAB (Composite Application Block) Views which are finally just UserControls (99% of the time) Anyway, I layout my UserControl in...
6
by: BurntWithTime | last post by:
Hello everyone, Please can anyone tell me if it is possible for a VB.NET application to check a database and then create textboxes on a form that correspond to those records on the database? For...
13
by: BobLewiston | last post by:
Can anybody tell me how to change WinForm controls' text color programatically? I have no problem finding the fields to assign colors to, but the compiler doesn't recognize any color I mention,...
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
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
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
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...
0
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...

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.