S
sugargenius
I've been tasked with updating an Access macro that exports company
actual costs into csv. The macro does some importing then runs a query
to create the output table. Finally, the output table is exported via
TransferText. The output table looks like
CHARGE_NUM BUDGET_ELEMENT HOURS DIRECT OVERHEAD
1001-001 43 100 5000 1500
1001-001 45 100 4500 100
1002-001 43 100 5000 1500
The first 4 characters of CHARGE_NUM are the project id. Right now the
macro exports one big file for all projects. I need it to create
seperate export files for each project.
If this were in foxpro, I might do something like:
LOCAL lcProjId
SELECT DISTINCT SUBSTR(CHARGE_NUM,1,4) AS PROJ_ID FROM OUTPUT INTO
CURSOR _csrProjID
SCAN
lcProjId = _csrProjID.PROJ_ID
SELECT * FROM OUTPUT WHERE SUBSTR(CHARGE_NUM,1,4) = lcProjId
IF RECCOUNT()>0
COPY TO lcProjId + "_ACTUALS.CSV" TYPE DELI
ENDIF
ENDSCAN
How would I accomplish this with Access?
Thanks,
Woody
actual costs into csv. The macro does some importing then runs a query
to create the output table. Finally, the output table is exported via
TransferText. The output table looks like
CHARGE_NUM BUDGET_ELEMENT HOURS DIRECT OVERHEAD
1001-001 43 100 5000 1500
1001-001 45 100 4500 100
1002-001 43 100 5000 1500
The first 4 characters of CHARGE_NUM are the project id. Right now the
macro exports one big file for all projects. I need it to create
seperate export files for each project.
If this were in foxpro, I might do something like:
LOCAL lcProjId
SELECT DISTINCT SUBSTR(CHARGE_NUM,1,4) AS PROJ_ID FROM OUTPUT INTO
CURSOR _csrProjID
SCAN
lcProjId = _csrProjID.PROJ_ID
SELECT * FROM OUTPUT WHERE SUBSTR(CHARGE_NUM,1,4) = lcProjId
IF RECCOUNT()>0
COPY TO lcProjId + "_ACTUALS.CSV" TYPE DELI
ENDIF
ENDSCAN
How would I accomplish this with Access?
Thanks,
Woody