I have what I think is a little strange...I have to get data from our
payroll system into a specific format (fixed record length) as a .txt
or .prn file only to upload to our 401k custodian.
I can get the data into Access (from Payroll) and write a query with
all the fields (inserting fields with spaces, as needed), but I can't
figure out how to get it to export to a .txt file - without the field
name header row.
I don't really understand Transfertext command - I don't get the
"specifications " parameter. And I can't find posts that explain that
to me. I think I have to do it for my own data to understand what it
all does.
SO, can anyone help? I have a query to output the data, and I think I
can write code to run the query. Or maybe it's just
DoCmd.TransferT ext - but my syntax and parameters are clearly wrong.
Thanks
Sara
My query is "qryB19Contribu tions" and I want to output it to
"TestFile.t xt" on my E: drive.
I don't want the header, so I thought just leaving out "Has Field
Names" would do that.
Do I have to write my data to a table first, then export the table?
DoCmd.TransferT ext acExportDelim, "qryB19Contribu tions", , "E:
\TestFile.txt") 6 8226
On Feb 28, 8:09 pm, "sara" <saraqp...@yaho o.comwrote:
I have what I think is a little strange...I have to get data from our
payroll system into a specific format (fixed record length) as a .txt
or .prn file only to upload to our 401k custodian.
I can get the data into Access (from Payroll) and write a query with
all the fields (inserting fields with spaces, as needed), but I can't
figure out how to get it to export to a .txt file - without the field
name header row.
I don't really understand Transfertext command - I don't get the
"specifications " parameter. And I can't find posts that explain that
to me. I think I have to do it for my own data to understand what it
all does.
SO, can anyone help? I have a query to output the data, and I think I
can write code to run the query. Or maybe it's just
DoCmd.TransferT ext - but my syntax and parameters are clearly wrong.
Thanks
Sara
My query is "qryB19Contribu tions" and I want to output it to
"TestFile.t xt" on my E: drive.
I don't want the header, so I thought just leaving out "Has Field
Names" would do that.
Do I have to write my data to a table first, then export the table?
DoCmd.TransferT ext acExportDelim, "qryB19Contribu tions", , "E:
\TestFile.txt")
I think the syntax you need is (watch for line wraps)...
DoCmd.TransferT ext acExportFixed, [SpecificationNa me],
"qryB19Contribu tions", "E:\TestFile.tx t"
However I *think* that to export a fixed-width file you must first
create an export specification. Easiest way to do this is to perform
an export once using the File>Export menu. Got through the motions of
picking the file path and name, click the Export button and a wizard
should open up. There should be an advanced button on it, click this
to open the Specifications tab. Make the neccessary changes to field
names, types etc. and click the Save As button to save the export
specification. Give it a name and remember it or write it down.
Continue the export. When you are done replace the [SpecificationNa me]
in my above example with the spec name you just saved - ie.
"MyExportSp ec". The TransferText method should work now.
I am Stunned! And forever grateful! I think I now understand how to
create the Export Spec and I actually created a form to run the code
and I have a file!
Now, I have to test with the custodian, but I never could have gotten
this far without your help.
Many many thanks.
sara
Maybe I spoke too soon?
While the .txt file is created, it does not have the leading zeroes
that I put in the spec. For example, and SSN that begins with 0 is
truncated.
The contribution amount, which the custodian wants as 9(07)v99, and I
set as 9 digits in the spec, comes over without the leading zeroes,
and with the decimal (which should not be included) and the data is
truncated:
11401750913 1435690 **A24.43 **A0
**A0 4
This should be (wrapping)
11401750913 001435690 **A000002443 **A000000000
**A000000000 4
The query DOES output the data correctly, as I have formatted the
fields in the query design grid: (001435690 is the SSN; 24.43 is the
contribution amount)
11401750913 001435690 ** A 000002443 ** A 000000000
** A 000000000 4
I don't know how to:
1. Get rid of the decimal to format the $ amount properly
2. "Keep" the leading zeroes
Any ideas?
thanks
sara
Sara,
I am working on a very similar problem right now and I believe that the only
way you're going to keep the leading zeros in a number field is to convert
it to text somewhere prior to exporting it to the text file. (As you have
seen, the export specification wizard allows you to use leading zeros in
dates, but doesn't provide that option for numbers.) You could either enter
an SSN into a text field to begin with, as opposed to a number field, or you
can convert the number to text (which is where my problem began). I couldn't
get any of the conversion functions to convert a date into text. I could get
it to look like text, but come time to export to the text file, it was still
treated as a date. I think you may want to look at the CStr function if you
want to try to convert before exporting. If you have no reason to enter the
SSN's as actual numbers (sorting on that field is the only thing I can think
of that that would make a number field necessary), it may just be easier to
enter them as text from the start.HTH
Steve
"sara" <sa*******@yaho o.comwrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
Maybe I spoke too soon?
While the .txt file is created, it does not have the leading zeroes
that I put in the spec. For example, and SSN that begins with 0 is
truncated.
The contribution amount, which the custodian wants as 9(07)v99, and I
set as 9 digits in the spec, comes over without the leading zeroes,
and with the decimal (which should not be included) and the data is
truncated:
11401750913 1435690 **A24.43 **A0
**A0 4
This should be (wrapping)
11401750913 001435690 **A000002443 **A000000000
**A000000000 4
The query DOES output the data correctly, as I have formatted the
fields in the query design grid: (001435690 is the SSN; 24.43 is the
contribution amount)
11401750913 001435690 ** A 000002443 ** A 000000000
** A 000000000 4
I don't know how to:
1. Get rid of the decimal to format the $ amount properly
2. "Keep" the leading zeroes
Any ideas?
thanks
sara
On Mar 1, 1:16 pm, "Steve Cartnal" <scart...@allte l.netwrote:
Sara,
I am working on a very similar problem right now and I believe that the only
way you're going to keep the leading zeros in a number field is to convert
it to text somewhere prior to exporting it to the text file. (As you have
seen, the export specification wizard allows you to use leading zeros in
dates, but doesn't provide that option for numbers.) You could either enter
an SSN into a text field to begin with, as opposed to a number field, or you
can convert the number to text (which is where my problem began). I couldn't
get any of the conversion functions to convert a date into text. I could get
it to look like text, but come time to export to the text file, it was still
treated as a date. I think you may want to look at the CStr function if you
want to try to convert before exporting. If you have no reason to enter the
SSN's as actual numbers (sorting on that field is the only thing I can think
of that that would make a number field necessary), it may just be easier to
enter them as text from the start.HTH
Steve
"sara" <saraqp...@yaho o.comwrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
Maybe I spoke too soon?
While the .txt file is created, it does not have the leading zeroes
that I put in the spec. For example, and SSN that begins with 0 is
truncated.
The contribution amount, which the custodian wants as 9(07)v99, and I
set as 9 digits in the spec, comes over without the leading zeroes,
and with the decimal (which should not be included) and the data is
truncated:
11401750913 1435690 **A24.43 **A0
**A0 4
This should be (wrapping)
11401750913 001435690 **A000002443 **A000000000
**A000000000 4
The query DOES output the data correctly, as I have formatted the
fields in the query design grid: (001435690 is the SSN; 24.43 is the
contribution amount)
11401750913 001435690 ** A 000002443 ** A 000000000
** A 000000000 4
I don't know how to:
1. Get rid of the decimal to format the $ amount properly
2. "Keep" the leading zeroes
Any ideas?
thanks
sara
As Steve mentioned you need to convert them into text, but don't use
CStr or other conversion functions on the actual field. The reason is
that even though you may have it formated in the table with leading
zeros, it's still just a number - formatting does NOT change the
value, just displays it differently. You can convert it in the query
by not including the actual field, but a calculated one based on it.
For example, assume fields [SSN] and [Amnt], and in the query design
create the following calculated fields...
TextSSN: Format([SSN], "000000000" )
TextAmnt Format(([Amnt]*100),"00000000 0")
(The amount field is multiplied by 100 to remove the decimal as per
your example. If your data contains a decimal place setting other than
two, change the multiplication accordingly.)
If the field values are SSN - 1234 and Amnt $25.98 then the query
should return 000001234 and 000002598. Since these query fields are
now strings (format function returns strings) it should export with
the leading zeros.
In case you did not encounter this before, run through the export
manually again, load the Spec you created last time, but watch for a
new window or the opportunity to size the fields. When I did it, a
window opened that placed a line between the fields based on their
fixed size but did not place a space between them. If your output
requires space between the fields, drag the line to the right so that
the required number of spaces are added.
Keep in the mind that doing this requires the importing program to be
able to convert these fields to appropriate data types. It should
easily convert them to numbers, but it would have to know that the
Amnt field should have a decimal somewhere in it.
Hope I didn't confuse you even more!
On Mar 1, 1:58 pm, "storrboy" <storr...@sympa tico.cawrote:
On Mar 1, 1:16 pm, "Steve Cartnal" <scart...@allte l.netwrote:
Sara,
I am working on a very similar problem right now and I believe that the only
way you're going to keep the leading zeros in a number field is to convert
it to text somewhere prior to exporting it to the text file. (As you have
seen, the export specification wizard allows you to use leading zeros in
dates, but doesn't provide that option for numbers.) You could either enter
an SSN into a text field to begin with, as opposed to a number field, or you
can convert the number to text (which is where my problem began). I couldn't
get any of the conversion functions to convert a date into text. I could get
it to look like text, but come time to export to the text file, it was still
treated as a date. I think you may want to look at the CStr function if you
want to try to convert before exporting. If you have no reason to enter the
SSN's as actual numbers (sorting on that field is the only thing I can think
of that that would make a number field necessary), it may just be easier to
enter them as text from the start.HTH
Steve
"sara" <saraqp...@yaho o.comwrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
Maybe I spoke too soon?
While the .txt file is created, it does not have the leading zeroes
that I put in the spec. For example, and SSN that begins with 0 is
truncated.
The contribution amount, which the custodian wants as 9(07)v99, and I
set as 9 digits in the spec, comes over without the leading zeroes,
and with the decimal (which should not be included) and the data is
truncated:
11401750913 1435690 **A24.43 **A0
**A0 4
This should be (wrapping)
11401750913 001435690 **A000002443 **A000000000
**A000000000 4
The query DOES output the data correctly, as I have formatted the
fields in the query design grid: (001435690 is the SSN; 24.43 is the
contribution amount)
11401750913 001435690 ** A 000002443 ** A 000000000
** A 000000000 4
I don't know how to:
1. Get rid of the decimal to format the $ amount properly
2. "Keep" the leading zeroes
Any ideas?
thanks
sara
As Steve mentioned you need to convert them into text, but don't use
CStr or other conversion functions on the actual field. The reason is
that even though you may have it formated in the table with leading
zeros, it's still just a number - formatting does NOT change the
value, just displays it differently. You can convert it in the query
by not including the actual field, but a calculated one based on it.
For example, assume fields [SSN] and [Amnt], and in the query design
create the following calculated fields...
TextSSN: Format([SSN], "000000000" )
TextAmnt Format(([Amnt]*100),"00000000 0")
(The amount field is multiplied by 100 to remove the decimal as per
your example. If your data contains a decimal place setting other than
two, change the multiplication accordingly.)
If the field values are SSN - 1234 and Amnt $25.98 then the query
should return 000001234 and 000002598. Since these query fields are
now strings (format function returns strings) it should export with
the leading zeros.
In case you did not encounter this before, run through the export
manually again, load the Spec you created last time, but watch for a
new window or the opportunity to size the fields. When I did it, a
window opened that placed a line between the fields based on their
fixed size but did not place a space between them. If your output
requires space between the fields, drag the line to the right so that
the required number of spaces are added.
Keep in the mind that doing this requires the importing program to be
able to convert these fields to appropriate data types. It should
easily convert them to numbers, but it would have to know that the
Amnt field should have a decimal somewhere in it.
Hope I didn't confuse you even more!- Hide quoted text -
- Show quoted text -
No, you didn't - you explained a lot! I actually got it all to work!
I found another post that showed the string function (just like
yours), so I totally got it. I'm on the second set of files now, and
the custodian is looking over the first set.
Again, thanks so much for your help, and thanks to Steve too. I anm
pretty proud of myself to have gotten this, but I couldn't have done
it without this group, and your help specifically.
Sara This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Angel Cat |
last post by:
I'm exporting a large file from a large Production database (SQL).
Users are currently updating and inserting new records.
Does the export take a snapshot of the data when it starts ? or will
it freeze the database so all udpates/inserts happen after the export
completes?
Also, how do I get the delta of data that wasn't exported, if I want
to get the difference the next day?
|
by: Chris |
last post by:
Could someone please provide me an effective means of
exporting data from a data set (or data grid) to Excel?
|
by: Janne Ruuttunen |
last post by:
Hello DB2 people,
I'm having problems exporting >= 250000 lobs to IXF files with the
LOBSINFILE option, using a legacy DB2 2.1 system on Win NT.
If I don't specify a path for the lobs, defining more than 250 base
names for the lobs leads to an error message something like "DB2
encountered an unexpected error when sending the query to the backend
process" (I don't have the exact message at hand). It doesn't matter
how short the base...
|
by: abhishek.srivastav |
last post by:
Hi
I m a new one in Db2 .I have a table which includes a varchar,date and
a clob column.I am trying to export all the columns at one go rather
than exporting the varchar and date type data once and then the clob
data . When doing this i;e exporting all the columns at one go,I m
getting the flat file of size Zero .No error is showing up in the
message file.The data just vanishes.
Someone please help
Thanks in Advance.
|
by: bienwell |
last post by:
Hi,
I have a question about exporting data from datagrid control into Excel file
in ASP.NET. On my Web page, I have a linkbutton "Export data". This link
will call a Sub Function to perform exporting ALL data from the datagrid
control. Exporting data works fine when I show all data on the datagrid
control.
I'd like to shows only 30 records on the datagrid control instead of ALL
data using page navigation, and perform exporting...
| |
by: Snozz |
last post by:
The short of it:
If you needed to import a CSV file of a certain structure on a regular
basis(say 32 csv files, each to one a table in 32 databases), what
would be your first instinct on how to set this up so as to do it
reliably and minimize overhead? There are currently no constraints on
the destination table. Assume the user or some configuration specifies
the database name, server name, and filename+fullpath. The server is
SQL...
|
by: Mux |
last post by:
I am facing the following problem while exporting data to Word.
The current implementation is as described below:
I have a JSP file which has a link that enables you to export the data
to
Word.
Clicking on the link invokes a javascript function:
function showRTF() {
var newWin = window.open("",
"newWin","width=900,height=800%,scrollbars=yes,menubar=yes,resizable=yes,too
|
by: myemail.an |
last post by:
Hi all,
I use Access 2007 and have the following problems: when exporting
banal select queries (either to Excel or to a csv file) I find that
exporting often doesn't work and creates a file with the WHOLE
dataset, i.e. including those rows which the criteria of the query
excluded.
For example: let's say I have a database with sales by region. I
create a select query to only show sales from Europe. The query runs
|
by: Marty Klunk |
last post by:
I have an Access97 data base where we are exporting records out to a text file that is then sent to a customer via EDI transmission. The problem I am having is that during the export process access is converting my number fields to scientific notation and they are getting bounced by our customer's EDI program. Example is .0027 is showing in the text file as 2.7E-3. I have tried setting formatting to fixed with 4 decimals, general with 4, no...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |