M
Mark H.
I am having a problem with properly exporting a field from Access 2000. The data starts its life in an Excel spreadsheet. The column that is causing problems is a field that contains either 1 digit or two digits (so a value between 0 and 99). I import this data into a table, and then eventually export it to a fixed width text file, which will be used as input to a mainframe job.
When I export the table containing the imported Excel data (although I don't think its origin is relevant, since it happens with data that I input into the table by hand) I end up getting a decimal point in the second byte for this column if the value in the column is a single digit. In other words, if the data is a "6", it ends up being a "6." in the fixed width file that is created. Also, if the data is padded with a leading zero, as in "06", the field ends up looking like "6." in the exported file. What I want it to do is be padded with a leading zero if there is a single digit in the field, or if it has a leading zero already in it, but Access seems to always want to remove the zero and put in a trailing decimal point.
I have tried defining the field in the Access table as various different types of numeric fields, as well as a text field, and it does not change the way the data ultimately gets exported. It always has a decimal point in the second byte when the data contains a single digit (or a value with a leading zero) in that field. In playing with the export specification (over and over again) it appears to me that the field "Decimal Symbol" that appears on the Export Specification screen is what is getting put after the single digit, since when I change that to, say, a semi-colon, the data in the exported file looks like "6;" instead of '6.'. There is no way that I can find to stop Access from placing the decimal separator after the data no matter what I have tried. I really thought changing the data type to text would prevent Access from trying to treat it as a number upon export but no such luck. All the other fields in the table get exported properly into fixed width columns in the file that is created, it is just this one field that is causing problems.
Is there a way that I can get this two byte field (whether it contains a single digit or is preceded by a leading zero) to contain a leading zero and then the digit when it is exported to a fixed width text file with capabilities built into Access? I am not much of a VB or other PC language programmer, and I want this to be a simple solution if possible, since I will be automating the import/export process and the simpler the better when it comes to automation. So, I'd like to avoid a complicated programming solution to this problem. I can write a pre-processor program on the mainframe to "fix" the data before it is used up there, but it seems like there should be a way to create the file properly in the first place.
Any ideas???
Thanks,
Mark
When I export the table containing the imported Excel data (although I don't think its origin is relevant, since it happens with data that I input into the table by hand) I end up getting a decimal point in the second byte for this column if the value in the column is a single digit. In other words, if the data is a "6", it ends up being a "6." in the fixed width file that is created. Also, if the data is padded with a leading zero, as in "06", the field ends up looking like "6." in the exported file. What I want it to do is be padded with a leading zero if there is a single digit in the field, or if it has a leading zero already in it, but Access seems to always want to remove the zero and put in a trailing decimal point.
I have tried defining the field in the Access table as various different types of numeric fields, as well as a text field, and it does not change the way the data ultimately gets exported. It always has a decimal point in the second byte when the data contains a single digit (or a value with a leading zero) in that field. In playing with the export specification (over and over again) it appears to me that the field "Decimal Symbol" that appears on the Export Specification screen is what is getting put after the single digit, since when I change that to, say, a semi-colon, the data in the exported file looks like "6;" instead of '6.'. There is no way that I can find to stop Access from placing the decimal separator after the data no matter what I have tried. I really thought changing the data type to text would prevent Access from trying to treat it as a number upon export but no such luck. All the other fields in the table get exported properly into fixed width columns in the file that is created, it is just this one field that is causing problems.
Is there a way that I can get this two byte field (whether it contains a single digit or is preceded by a leading zero) to contain a leading zero and then the digit when it is exported to a fixed width text file with capabilities built into Access? I am not much of a VB or other PC language programmer, and I want this to be a simple solution if possible, since I will be automating the import/export process and the simpler the better when it comes to automation. So, I'd like to avoid a complicated programming solution to this problem. I can write a pre-processor program on the mainframe to "fix" the data before it is used up there, but it seems like there should be a way to create the file properly in the first place.
Any ideas???
Thanks,
Mark