Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report clearing

Status
Not open for further replies.

VRach02

Technical User
Oct 30, 2003
35
0
0
CA
I have code to open and using an exisitng report, but it has controls on it sometimes that i don't want. Is there any code to delete controls on startup?

Or is the code to create a report in stead of the docmd.openreport.?

Vishal
 
Set the controls' visible property to False.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
No the problems isn't seeing the control. It is that on opening of the report in design view the code begins to creat new controls ina sequential manner and names them as such. Ie Textbox1, textbox2, textbox3 and so on. The number of boxes is determined by the number of selections in a list box
If i exit the code and go back to the report the controls and still there. and upon restarting the code access cannot make and name two controls textbox1 so i want to find a way to delete all the control on the page before access begins to make the new controls.

thanks
 
If you are saving the report after deleting and creating the controls you will probably run into problems since the total number of controls that can be created in a report is 754. A deleted control still takes 1 of the 754 until the database is compacted.

Is there a reason why you don't create 100 text boxes and make them all invisible? In the On Open event, you can make the text boxes visible based on the number of selections in the list box. I think this would be much more efficient.

If you are not binding the controls then you can use code to Print values in the report without creating controls.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks for the help i managed to create using a loop on a previously saved report a set of all the textboxes that i needed.

Now in the detail format section of the code is series of loops that fills the textboxes.
I was wondering if this was possible to do using code in the main form ina command button.
The problem arises when i am using variable names for the textboxes in the report i can call on them specifically.

When in the report detail section i was using

Me("txtSubHeading" & var) = CRTL.Column(4, VarItmSub)

but that does not seem to be working.

Vishal

 
It would help to understand the basic goal of this process.
It looks like you are attempting to allow users to create custom reports on the fly in an application. If this is the case you might want to check out the DH Query By Form at This "applet" can easily be added to any mdb for very flexible reporting. Results of the queries are 1 click away from sending to Word, Excel, Print, HTML, Merge, CSV, Graph,...

Otherwise (back to your question), I don't know where "CTRL" is coming from or what your code is doing.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
sorry duane,

The goal is for the user to be abel to choose froma control (list box) (which is what crtl defines earlier) and from teh multiple selections made we create a report and from there put on the appropriate number of texboxes and i WAS in the detial section filling the text boxes.

The line of code sets the report taht has the textbox named "txtsuheading" and a variable and set it to the name in the listbox(CRTL) in column 4 and row varitmsub.
Here's the entire loop

For var = 1 To CRTL.ItemsSelected.Count
If Me(&quot;txtSubHeading&quot; & var) <> &quot;&quot; Then
GoTo a:
Else
Me(&quot;txtSubHeading&quot; & var) = CRTL.Column(4, VarItmSub)
GoTo b:
End If
a:
Next var
 
Did you check the download I suggested?
I would place your code in the On Open event of the report.
Are you aware the columns are numbered starting with 0?

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
yesi am aware of the columns at 0

the problems stems from this coming from the on code ina report to moving to to the code in a form.

Is it possible to have the code put in to the on open event of the report or detail format section from code in a form?

VIshal
 
Duane,
Thanks again for all the help
I was not ignoring the suggestion for the other website i am willing to try anything you propose.

I am as we speak reviewing that old suggestion and it very nicely written, but perhaps abt confusing for me and seems to be taking some time and decipering for me to understand.
I apologize if it seemed like i was ignoring you ideas.

A question about that db it seems that the information is loaded into a subform and then sent to word directly. Without even using an access report?
Am i seeing this wrong? (again , having trouble understanding)

I will take a look at that new webiste and program, it may help as well.


Thank you
Vishal
 
Duane,
I am look at the new suggestion that you have and it calls to open a report that already exists.

My case deals with a report that was just created. I can handle a report that exists because the codei have will fit in the detail format and work great.

Let me reivew.
I have a report that i just created and then created a variety of listboxes named from 1 to whatever number.
Then i would like to have code that fills those listboxes but the problem comes in refering to the textboes with variables in the name?

Vishal
 
Why are you creating a &quot;variety fo listboxes&quot;? Do you mean text boxes? Are you attempting to bind text boxes on a report based on the items selected in a multi-select list box on a form?

The sample query by form does not use a report. It sends the data to Excel or Word or other for the user to print.

The sample from Roger's library I believe uses a report and does what you ask.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Duane,

Thanks for that help.
This is getting too complicated and disorganized.
I am going to scrap creating a report and use a template report instead and send it to word.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top