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!

A query question

Status
Not open for further replies.

sealahu

Programmer
Aug 5, 2003
16
US
I have a queryA
select AccountID,name,Manager from Account
where AccountID = '007'
the results is
================================
AccountID Name Manager
007 TEST Joe
007 TEST Mary
================================

In fact what I like to have is: if this account has 2 managers, then get the result:

=========================================
AccountID Name Manager1 Manager2
007 TEST Joe Mary
==========================================

How to write this query?

 
more importantly, what do you want to do with the data? spit it out to a forms field? depending on what you want to do can change how to perform the operation
 
Those info will merge into a word document. If manager field, I need the 2 managers name in one place within one page, otherwise the word document will be merged to 2 pages

Any means, I need to write a query that could merge 2 records to one record.
 
Yeah, you can create a module that will run through the recordset and adding to a couple of arrays (arrAccountID(), arrName(), and arrManagers()) just telling it if the account exists in the arrAccountID() array and the same index of the Name array, arrName(), then add the manager to the arrManager() array with the same index.

Once the arrays are built, you can use the word object and create a new document by looping through your arrays.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top