Create a new label on Access Report programatically

jackyccc

New member
Local time
Today, 01:43
Joined
May 2, 2008
Messages
3
I've been trying to create a new label on Access Report programatically during Run-Time with the following codes. But i kept getting the error message "Run-Time Error 29054 - Microsoft Office Access can't add, rename, or delete the control(s) you requested." Why?

FYI, i'm using Access 2003, and the following code runs from a button click event on a form.


DoCmd.OpenReport Report_rTextInquiry.Name, acViewDesign, , , acHidden

Dim NewLabel1 As Control

Set NewLabel1 = CreateReportControl(Report_rTextInquiry.Name, acLabel, acDetail)


Can anyone help me on this issue? I've been trying for the entire afternoon. Millions thanks in advanced.
 
Why do you need to create a label through VBA? If you want to be able to change the text of the label I would suggest using an unbound text box and then set the recordsource of the box to display what ever you want. Can you explain what you are trying to do and why? This helps alot in giving advice.
Tyler
 
You can change the caption if you make it a textbox that looks like a label.
If the textbox is set to not visable you could make it visable and change the caption.
.visable = True
.caption = ???
 
You can also have Labels as text fields with the corresponding text field beside it with both having height set to 0 and Can Grow set to Yes. When you populate that Label & field they appear on the report, otherwise, they are invisible. Be aware, when they are populated, they will move the lines below down by their size.
 

Users who are viewing this thread

Back
Top Bottom