reports ( using variables in labels)

C

Chris

I have a report bound to a query. I would like to have a label saying
something like;

Your case administrator is John Smith Please contact him

I've tried to have a text box contain the Case administrator and then make
the variable = the text box.

strCaseAdmin = me.txtBoxName

lblStuff.Caption = Your case administrator is & " strCaseAdmin " & " " & "
please contact him.

I get the message 2427: You entered an expression that has no value

I have the code in the Open event of the report.

Please help me
 
A

AlCamp

Chris,
I'm a bit confused about your what you're trying to do... but...

If you have a field in your report called [Adminstrator] that contains
the name of the case administrator, then you can just concatenate that value
into a text string in an unbound text control.

Create a Text control (not a Label) on your report called CaseAdminNote
and use this ControlSource...
= "Your case administrator is " & [Administrator] & ", please
contact him."

This will display as...
Your case administrator is John Smith, please contact him.
hth
Al Camp
 
C

Chris

CHEERS! I'm adjusting another database and the way it was set up was to use
labels.

In text boxes, How would I use a VbCrLf?

I've been trying puting it into concatenation but the DB seems to think
it is a Field

AlCamp said:
Chris,
I'm a bit confused about your what you're trying to do... but...

If you have a field in your report called [Adminstrator] that contains
the name of the case administrator, then you can just concatenate that value
into a text string in an unbound text control.

Create a Text control (not a Label) on your report called CaseAdminNote
and use this ControlSource...
= "Your case administrator is " & [Administrator] & ", please
contact him."

This will display as...
Your case administrator is John Smith, please contact him.
hth
Al Camp

Chris said:
I have a report bound to a query. I would like to have a label saying
something like;

Your case administrator is John Smith Please contact him

I've tried to have a text box contain the Case administrator and then make
the variable = the text box.

strCaseAdmin = me.txtBoxName

lblStuff.Caption = Your case administrator is & " strCaseAdmin " & " " & "
please contact him.

I get the message 2427: You entered an expression that has no value

I have the code in the Open event of the report.

Please help me
 
A

AlCamp

Chris,
Did my first concatenation solution work for you?

Use VbCrLf just like a variable...
= "Your case administrator is " & [Administrator] & "," & VbCrLf &
"please contact him."
would yield...
Your case administrator is John Smith,
please contact him.
hth
Al Camp

Chris said:
CHEERS! I'm adjusting another database and the way it was set up was to
use
labels.

In text boxes, How would I use a VbCrLf?

I've been trying puting it into concatenation but the DB seems to think
it is a Field

AlCamp said:
Chris,
I'm a bit confused about your what you're trying to do... but...

If you have a field in your report called [Adminstrator] that contains
the name of the case administrator, then you can just concatenate that value
into a text string in an unbound text control.

Create a Text control (not a Label) on your report called
CaseAdminNote
and use this ControlSource...
= "Your case administrator is " & [Administrator] & ", please
contact him."

This will display as...
Your case administrator is John Smith, please contact him.
hth
Al Camp

Chris said:
I have a report bound to a query. I would like to have a label saying
something like;

Your case administrator is John Smith Please contact him

I've tried to have a text box contain the Case administrator and then make
the variable = the text box.

strCaseAdmin = me.txtBoxName

lblStuff.Caption = Your case administrator is & " strCaseAdmin " & " "
& "
please contact him.

I get the message 2427: You entered an expression that has no value

I have the code in the Open event of the report.

Please help me
 
C

Chris

Yes your first bit worked. The VbCrLF doesn't. It looks for the VbCrLf as
a field and automatically adds [] around it. it's Ok though. I've managed
to add & " " to the code and the sentence goes onto the next line.

Thanks alot. My boss is happier now!!!
AlCamp said:
Chris,
Did my first concatenation solution work for you?

Use VbCrLf just like a variable...
= "Your case administrator is " & [Administrator] & "," & VbCrLf &
"please contact him."
would yield...
Your case administrator is John Smith,
please contact him.
hth
Al Camp

Chris said:
CHEERS! I'm adjusting another database and the way it was set up was to
use
labels.

In text boxes, How would I use a VbCrLf?

I've been trying puting it into concatenation but the DB seems to think
it is a Field

AlCamp said:
Chris,
I'm a bit confused about your what you're trying to do... but...

If you have a field in your report called [Adminstrator] that contains
the name of the case administrator, then you can just concatenate that value
into a text string in an unbound text control.

Create a Text control (not a Label) on your report called
CaseAdminNote
and use this ControlSource...
= "Your case administrator is " & [Administrator] & ", please
contact him."

This will display as...
Your case administrator is John Smith, please contact him.
hth
Al Camp

I have a report bound to a query. I would like to have a label saying
something like;

Your case administrator is John Smith Please contact him

I've tried to have a text box contain the Case administrator and then make
the variable = the text box.

strCaseAdmin = me.txtBoxName

lblStuff.Caption = Your case administrator is & " strCaseAdmin " & " "
& "
please contact him.

I get the message 2427: You entered an expression that has no value

I have the code in the Open event of the report.

Please help me
 
A

AlCamp

Chris,
I was thinking of text for a message box, and that code would be OK. So
would
Chr(10) & Chr(13) (carrier return & line feed from the old DOS
days)
Your " " method is OK, but not too elegant... :)

Could you give me more info on what you're doing with this Text control?
Is it a bound table field that holds different text strings?
Or... is it more like a label or title that always contains the same text
string.
And what would that string be?
hth]
Al Camp

Chris said:
Yes your first bit worked. The VbCrLF doesn't. It looks for the VbCrLf
as
a field and automatically adds [] around it. it's Ok though. I've
managed
to add & " " to the code and the sentence goes onto the next
line.

Thanks alot. My boss is happier now!!!
AlCamp said:
Chris,
Did my first concatenation solution work for you?

Use VbCrLf just like a variable...
= "Your case administrator is " & [Administrator] & "," & VbCrLf &
"please contact him."
would yield...
Your case administrator is John Smith,
please contact him.
hth
Al Camp

Chris said:
CHEERS! I'm adjusting another database and the way it was set up was
to
use
labels.

In text boxes, How would I use a VbCrLf?

I've been trying puting it into concatenation but the DB seems to think
it is a Field

Chris,
I'm a bit confused about your what you're trying to do... but...

If you have a field in your report called [Adminstrator] that contains
the name of the case administrator, then you can just concatenate that
value
into a text string in an unbound text control.

Create a Text control (not a Label) on your report called
CaseAdminNote
and use this ControlSource...
= "Your case administrator is " & [Administrator] & ", please
contact him."

This will display as...
Your case administrator is John Smith, please contact him.
hth
Al Camp

I have a report bound to a query. I would like to have a label
saying
something like;

Your case administrator is John Smith Please contact him

I've tried to have a text box contain the Case administrator and
then
make
the variable = the text box.

strCaseAdmin = me.txtBoxName

lblStuff.Caption = Your case administrator is & " strCaseAdmin " & " "
&
"
please contact him.

I get the message 2427: You entered an expression that has no value

I have the code in the Open event of the report.

Please help me
 
Top