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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print the value of a Form Label on a report

Status
Not open for further replies.

DIRENE

Technical User
Jan 19, 2004
51
0
0
US
Hi All,

I have a form that has a simple Multiselect ListBoxes on it that pulls the ones I select to a label on the form. Now I would like the report to pull the value of the label to the report so that everything I select is in one group. Like:

blue
4dr
xlt trim

Thanks for you help.

Irene
 
do you REALLY mean a label ?

or is it actually a Text Box control ?


If the Form is frmFred

and the thing really is in a label ( called lblFreddy )

Then in the report's appropriate Section OnFormat event put code like

txtDisplay = Forms!frmFred!lblFreddy.Caption


If as I suspect, the control is a text box ( called txtFreddy ) then use

txtDisplay = Forms!frmFred!txtFreddy





'ope-that-elps.


G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
It's really a label and

when I put on format on the report detail area:
LABEL1= Forms!frmO!LABEL1.Caption

If I run the report I get a error

access can not find the marco LABEL1= Forms!frmO!LABEL1.Caption

Irene

 
Sorry and Thank you I got it to work
 
I seem to have one problem still, If I select two thing in my listbox I get two set of information If I select three I get three ect.

Any ideas to just get one set
 
The whole point about labels is that they are ment to be 'labels' - ie not fiddled about with at run time.

Use text box controls - they have a lot more functionality and will make your life a lot easier.


As for your One,Two or Three records issue - I've no where near enough information.

What's the report bound to?
What filters are applied ?
How does the Report use the data in a 'label' to select record?
If you are entering 3 items of data - why on earth don't you expect / want 3 records in the result?





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Sorry I again I fooled around with my code and got this to work. The reason for only wanting one set is. I'm trying to do away with hand typing stock cards. We end up type the same thing over a dozen of time for different stock numbers. So I made a form that I type the stock number, vin ect. But I want to just pick the option that go for that stock number. I do have it working but there is always one more ????

You had me put on detail format:

Text23 = Forms!frmO!label1.Caption

Is there away to make this print in column if I have select more then say ten items. The problem is that stock cards are only 4x8 and if I select a lot of option it goes off the pages.

Thanks Irene
 
I have used a think one - a long time ago where I counted the rows that text would take up in a text box and then adjusted the font size of the text box in a select statement

intRowcount = ( calc no. of rows)

SELECT CASE intRowCount
Case < 5
txtCard.Fontsize = 12
Case < 10
txtCase.Fontsize = 10
Case Else
txtCase.FontSize = 8
EndSelect


'ope-that-elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
I add this line in the detail on format:

intRowcount = ( calc no. of rows)
Select Case intRowcount
Case Is < 5
Text23.FontSize = 12
Case Is < 10
Text23.FontSize = 10
Case Else
Text23.FontSize = 8
EndSelect

And I,m getting a compile error syntax error

thanks irene
 
It would normally be more helpful if you said WHERE the error is occuring and what the error message is.

However it is clear in this case you have simply copied my guidance comments into your code without applying any level of intelect to it's contents.

Replace the comment in brackets by some real code that does what the comments hint at.



 
I'm sorry about that meant to tell you that infomation.

But I have no idea how to start write some real code to do this.

Thanks Irene
 
A simple approach ( and first approximation ) might be


( Len(TextToBeDisplayed) \ NoOfCharsPerLine ) + 1


As long as you don't have too many CrLf in the text or very long words and a narrow text box then that should work reasonable well.


'ope-it-'elps.




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top