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

QBE field formatting 2

Status
Not open for further replies.

zimmer9

Programmer
Jan 12, 2005
66
US
I have 2 fields that I want to concatenate (and remove the high order position of 1 of these fields) and display them as 1 composite field with a different field name on a report.

For example: I have a field named OfficeNumber and a field named CustomerNumber.

Office Number has a value of 0100
Customer Number has a value of 333333

I wrote a SQL statement as follows to handle this condition:
Right(tblCustomers.OfficeNumber, 3) + ' ' + tblCustomers.CustomerNumber AS [Account Number]

The result is a new field title called "Account Number" with a value of 100 333333

However, I want to translate this SQL code formatting I noted above to these 2 fields on the QBE in the row titled Field:

Could you tell me how I would express the formatting into the fields Office Number and CustomerNumber on the QBE to generate 1 composite field titled Account Number ?

 
If you wite the SQL in the SQL view of the QBE and switch to design view, voila;-)

[tt][Account Number]: Right(tblCustomers.OfficeNumber, 3) & " " & tblCustomers.CustomerNumber[/tt]

We often use & for concatenation in Access, and in the QBE quotes in stead of single quotes.

Roy-Vidar
 
In the QBE you don't choose the OfficeNumber field nor the CustomerNumber, but an expression:
AccountNumber: Right(tblCustomers.OfficeNumber, 3) & ' ' & tblCustomers.CustomerNumber

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Gee - included [brackets] - they aren't necessary, or could even produce an error [blush]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top