Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

change label on subFORM in REPORT

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Henrootje - 15 May 2007 10:23 GMT
I have a REPORT with in it a subFORM Now I have this label (lblMonth)
that I want to change. How should I do this? What would be the proper
event to do this? The lblMonth should contain the name of the month as
jan 07 Any ideas?

TIA, Henro
Maurice - 15 May 2007 18:27 GMT
What do you mean exactly, do you want the label to change dynamically or
should it just say jan 07. Either way run in code you could try something
like:

me.(subreportname).controlname.caption="jan 07" where controlname is the
name of the label and subreportname is the name of your subreport.

Sometimes it is neccesary to use the full suntaxis like:

Reports![mainreportname]![subreportname]!controlname.caption="your text"

Remember a label has a caption and not a value.

Maurice

> I have a REPORT with in it a subFORM Now I have this label (lblMonth)
> that I want to change. How should I do this? What would be the proper
> event to do this? The lblMonth should contain the name of the month as
> jan 07 Any ideas?
>
> TIA, Henro
Henrootje - 16 May 2007 08:23 GMT
I will try to explain more in detail

I made a form (with some subforms)  and I copied it to a report.
Now I ended up with a REPORT (Report1) that has subFORMS (subForm1)

On the subFORM there is a label whose caption should change depending
on a string that is mentioned in the header of the report.
In short the string would be something like: "Corporate Clients 2007 -
Q1"
Using right() I derive the number '1'

the code should be something like:

Dim Q

Q= right(String, 1)

Select Case Q

Case 1
[Code to change the captionof label1 on subform, something like:]
      rpt.REPORT1.Forms!subForm1.label1.caption = "some text"
      rpt.REPORT1.Forms!subForm1.label2.caption = "some text"
Case 2
[Code to change the captionof label1 on subform, something like:]
      rpt.REPORT1.Forms!subForm1.label1.caption = "some text"
      rpt.REPORT1.Forms!subForm1.label2.caption = "some text"

End Select.

This should happen when the report is opened.
I find I can not execute any code in the subforms (just will not be
executed :s)
and when using code above I get an error that the object can not be
found which, according my reading about this subject, has something to
do wit an incorrect syntax in the rpt.blablabla
part.............................

Any one has any useful suggestions? Please? I have been at this for a
week, might it be that it is a report with subFORMS that is causing
the trouble????

TIA,

Henro

> What do you mean exactly, do you want the label to change dynamically or
> should it just say jan 07. Either way run in code you could try something
[quoted text clipped - 19 lines]
>
> - Tekst uit oorspronkelijk bericht weergeven -
Maurice - 16 May 2007 20:52 GMT
You've copied a form onto the report, why don't you try creating a new
subreport instead of the subform. Just create a subreport like the subform.
In code replace the forms references for Report so it could look something
like:

rpt.REPORT1.sRpt1.label1.caption = "some text" -> where srpt1 is the new
subreport you've created.

I don't know if code in the subform will trigger from a report. I do know
that code from a subreport will be triggered. So it could be an object
problem (report mixed with form).

Have a go and let us know if it resolves the issue and otherwise I'll look
into it some more.

Maurice

> I will try to explain more in detail
>
[quoted text clipped - 65 lines]
> >
> > - Tekst uit oorspronkelijk bericht weergeven -
Henrootje - 17 May 2007 18:46 GMT
Creating a subreport instead of a subform made things work!

> You've copied a form onto the report, why don't you try creating a new
> subreport instead of the subform. Just create a subreport like the subform.
[quoted text clipped - 82 lines]
>
> > > - Tekst uit oorspronkelijk bericht weergeven -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.