Concatenate two variables together and display this on the report?

R

Richard Horne

Hi guys, I'm struggling with a problem I'm having.

I have two fields on a report, one called Customer_Supplier which can have a
value of lets say for instance SuppA SuppB or SuppC.

I have another field called Purchase_Order_Number, now depending on the
value of Customer_Supplier I want to concatenate either an A B or a C onto
the beginning of the Purchase Order field - but only to be displayed on the
report.

How do I achieve this?
 
A

Allen Browne

So it is the right-most character of the Customer_Supplier field?

Try something like this in the Control Source of your text box:
=Right([Customer_Supplier],1) & [Purchase_Order_Number]

Note that the Name of this text box must not be the same as the name of the
fields.
 
R

Richard Horne

Hi Allen, that's along the right lines but I'll also need to insert a
switch/case statement as I simplified the problem for my explanation.

The Supplier Category actually has the fields, Supplier A, Supplier B,
Supplier C, Un-Approved Supplier, Customer, Other, Customer/Supplier A,
Customer/Supplier B and Customer/Supplier C.

I simply want to put an A B or C in front of the purchase order number - or
on the end whichever is easiest so that we can easily tell which category of
supplier our purchase orders are for.

So obviously I'll firstly need a few IF and IF ELSEsto set a variable to
either be A B or C.

I'll have a play with the code you wrote and see if I can figure something
out.

Thanks Allen.
Allen Browne said:
So it is the right-most character of the Customer_Supplier field?

Try something like this in the Control Source of your text box:
=Right([Customer_Supplier],1) & [Purchase_Order_Number]

Note that the Name of this text box must not be the same as the name of the
fields.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Richard Horne said:
Hi guys, I'm struggling with a problem I'm having.

I have two fields on a report, one called Customer_Supplier which can have
a
value of lets say for instance SuppA SuppB or SuppC.

I have another field called Purchase_Order_Number, now depending on the
value of Customer_Supplier I want to concatenate either an A B or a C onto
the beginning of the Purchase Order field - but only to be displayed on
the
report.

How do I achieve this?
 
A

Allen Browne

IIf() or Switch() might be useful.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Richard Horne said:
Hi Allen, that's along the right lines but I'll also need to insert a
switch/case statement as I simplified the problem for my explanation.

The Supplier Category actually has the fields, Supplier A, Supplier B,
Supplier C, Un-Approved Supplier, Customer, Other, Customer/Supplier A,
Customer/Supplier B and Customer/Supplier C.

I simply want to put an A B or C in front of the purchase order number -
or
on the end whichever is easiest so that we can easily tell which category
of
supplier our purchase orders are for.

So obviously I'll firstly need a few IF and IF ELSEsto set a variable to
either be A B or C.

I'll have a play with the code you wrote and see if I can figure something
out.

Thanks Allen.
Allen Browne said:
So it is the right-most character of the Customer_Supplier field?

Try something like this in the Control Source of your text box:
=Right([Customer_Supplier],1) & [Purchase_Order_Number]

Note that the Name of this text box must not be the same as the name of
the
fields.

Richard Horne said:
Hi guys, I'm struggling with a problem I'm having.

I have two fields on a report, one called Customer_Supplier which can
have
a
value of lets say for instance SuppA SuppB or SuppC.

I have another field called Purchase_Order_Number, now depending on the
value of Customer_Supplier I want to concatenate either an A B or a C
onto
the beginning of the Purchase Order field - but only to be displayed on
the
report.
 
Top