vba exporting data

B

Bre-x

Hi,
I am exporting data to MS Excel

ID, WOPRE, WOSUF, WOOPER
1, 5230, 23, 10
2, 5230, 23, 20
3, 5230, 23, 30
4, 5230, 30, 10
5, 5230, 30, 20

How I can accomplish this:

ID, WOPRE, WOSUF, WOOPER
1, 5230, 23, 10
2, Null , 23, 20
3, Null, 23, 30
4, 5230, 30, 10
5, Null, 30, 20

Only the first "Operation" (WOOPER) should have the Work Order Information
(WOPRE, WOSUF)

Thank you all!!
 
O

OssieMac

Hi,

First create a query with 2 virtual fields (expressions in lieu of real
fields). These expressions should be like the following:

Expr1: IIf([tblOrig]![WOOPER]=10,[tblOrig]![WOPRE],Null)
Expr2: IIf([tblOrig]![WOOPER]=10,[tblOrig]![WOSUF],Null)

Uncheck the Show boxes for the fields you do not want to display. (for
example the real fields WOPRE and WPSUF)

Now when you run the query you should get the results you want.

You can change Expr1 and Expr2 to resemble the real fields like this (Note
the appended1 so they are not exactly the same as the real fields):

WOPRE1: IIf([tblOrig]![WOOPER]=10,[tblOrig]![WOPRE],Null)
WOSUF1: IIf([tblOrig]![WOOPER]=10,[tblOrig]![WOSUF],Null)

Now Export the query
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top