Make a Text file

W

Wahab

Hi everybody,
I want to create simple text file from my query. For the
transfer of salary to bank, bank gaves me spesific format
to create a text file. Please advice me how I will do
that,format is as follow:
EmpAcc: This is the account number with 13 degits
0604186969100 (each account is having 13 degists)
EmployeeName: Name with 50 characters if less it should
fill with spaces.
NetSalary :9 degits which will look like this 00195.500,
if salary is 50 only than I should send 00050.000 like this
EmpNo :4 degits card no.
I have total four fields each field must be seprated by
space. I dont want any line or column line, this file must
be plane and I'm going to save on my flopy.
Thanks in advance.
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You'll have to create an Export Specification with all the columns as
Text data. Set it as a Fixed Width output. Then create the query
SELECT clause like this:

SELECT Format(EmpAcc, String(13,"0")) & " " As Emp_Acc,
Format(EmployeeName, String(50, " ")) & " " As Emp_Nm,
Format(NetSallary, String(5,"0") & ".000") & " " As Net_Sal,
Format(EmpNo, String(4,"0")) As Emp_No
FROM TableName
.... etc. ...

The Format() function turns the values into strings of the appropriate
length/format. The (& " ") at the end of the Format() function adds
the required space between fields. This last part sounds odd because
fixed width files usually don't have spaces between fields. But, if
that's how the bank asked for it....

Finally export the query results by using the TransferText method of
the DoCmd object (see the Access VBA help on TransferText).

HTH,

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQBgxoYechKqOuFEgEQJqzQCg47EzvV46iTbrNqjdNCsOIqPRPhgAoJGC
6LOziB2hvw1DeIrqkN/sw5Dz
=oFLY
-----END PGP SIGNATURE-----
 

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