Fixing the extract table problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 
I'm still having a problem when I go to restore the data, if I use the _ at
the end of the field the restore doesn't find that field in the original
table. I've tried not using the headers, but what happens is that it thinks
that the 3 decimal field is a text field and will not restore it. Is there
any way to make it not change to text? I think this will work only have this
one problem.
Thanks hopefully you will be able to help me with this also.

CD Tom

strive4peace said:
Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
I've been playing around with this and like I mentioned if I leave the field
headings in the export file then when I do a restore it comes up saying that
the field_ is not in the table. I tried going false with the headings but
not when it runs it says that it doesn't have a field "5" in the table and of
course field 5 is the 3 decimal field. So I'm not to sure what to do now.
You help again would be appreciated.

CD Tom

strive4peace said:
Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
Now here's a funny thing when I do the import from the file menu and select
the exported .txt file it works fine, but when I do it with the
docmd.transfertext acimportdelim command it comes up with the error about the
field not being in the table. I've set the headers off in both the export
and the import command.

CD

strive4peace said:
Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
Hi Tom,

can you post the SQL for the query you are using to export?

from the menu when you are in design or datasheet view of the Query -->
View, SQL

if you are exporting, you need to use acExportDelim, not acimportdelim

can you explain why you are exporting? What is being done with the
exported information?



Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
Now here's a funny thing when I do the import from the file menu and select
the exported .txt file it works fine, but when I do it with the
docmd.transfertext acimportdelim command it comes up with the error about the
field not being in the table. I've set the headers off in both the export
and the import command.

CD

strive4peace said:
Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
I'm using the export as a backup, there is a menu option to backup data, this
in turn exports all the data in the tables to the .txt files. This is a
scoring system that is used during matches, the users use the backup to
backup the data for the current match. If they ever need to go back to a
given match then can do the restore, the program will delete the rows from
the current tables and restore them back to the match they wish to see. I
also have the users send me the .txt files if they have any problems. I then
just restore them and can check to see what there problem is.
Here is the sql of the query, I've only tested with the first time1, like is
said before the extract seems to be working fine, it's now when I try and
restore the data that I get the error regarding the field "5" not in table,
I've set the export to have no headings and have setup a spec. file for the
import but it is still coming up with the same error.
SELECT Scores.SASS_number, Scores.Shoot_date, Scores.ShooterNumber,
Scores.Division, CDbl(Format([time1],"#,##0.000")) AS Time1_, Scores.Rank1,
Scores.Misses1, Scores.Penalties1, Scores.Bonus1, Scores.TTime1,
Scores.Time2, Scores.Rank2, Scores.Misses2, Scores.Penalties2, Scores.Bonus2,
Scores.TTime2, Scores.Time3, Scores.Rank3, Scores.Misses3, Scores.Penalties3,
Scores.Bonus3, Scores.TTime3, Scores.Time4, Scores.Rank4, Scores.Misses4,
Scores.Penalties4, Scores.Bonus4, Scores.TTime4, Scores.Time5, Scores.Rank5,
Scores.Misses5, Scores.Penalties5, Scores.Bonus5, Scores.TTime5,
Scores.Time6, Scores.Rank6, Scores.Misses6, Scores.Penalties6, Scores.Bonus6,
Scores.TTime6, Scores.Time7, Scores.Rank7, Scores.Misses7, Scores.Penalties7,
Scores.Bonus7, Scores.TTime7, Scores.Totaltime, Scores.TotalRank,
Scores.Matchfinal, Scores.ClassFinal, Scores.Scored, Scores.Shootorder1,
Scores.Shootorder2, Scores.Shootorder3, Scores.Shootorder4,
Scores.Shootorder5, Scores.Shootorder6, Scores.Shootorder7, Scores.Extra_1,
Scores.Extra_2, Scores.Extra_3, Scores.Extra_4, Scores.MatchFee,
Scores.CKBox1, Scores.CKBox2, Scores.CKBox3, Scores.CKBox4, Scores.CKBox5,
Scores.CKBox6, Scores.CKBox7, Scores.DNFMDQ, Scores.Horsenumber
FROM Scores;

strive4peace said:
Hi Tom,

can you post the SQL for the query you are using to export?

from the menu when you are in design or datasheet view of the Query -->
View, SQL

if you are exporting, you need to use acExportDelim, not acimportdelim

can you explain why you are exporting? What is being done with the
exported information?



Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
Now here's a funny thing when I do the import from the file menu and select
the exported .txt file it works fine, but when I do it with the
docmd.transfertext acimportdelim command it comes up with the error about the
field not being in the table. I've set the headers off in both the export
and the import command.

CD

strive4peace said:
Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD Tom wrote:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
I just realized that I still have the default windows setting for decimals to
3, when I changed it back to 2 the export of the file went back to only
extracting 2 decimals. It sure looks like access is using the windows
setting to export the table, and it doesn't matter what the table column is
set to. When I do the export through the menus and can see the data before
it exports it out to the .txt file it shows there are 3 decimals but when you
look at the exported file there are only 2 decimals exported. I don't know
what to do now unless there is a different way I could do the backup without
making a complete backup of the whole database. Do you have any other ideas.
Tom

strive4peace said:
Hi Tom,

can you post the SQL for the query you are using to export?

from the menu when you are in design or datasheet view of the Query -->
View, SQL

if you are exporting, you need to use acExportDelim, not acimportdelim

can you explain why you are exporting? What is being done with the
exported information?



Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
Now here's a funny thing when I do the import from the file menu and select
the exported .txt file it works fine, but when I do it with the
docmd.transfertext acimportdelim command it comes up with the error about the
field not being in the table. I've set the headers off in both the export
and the import command.

CD

strive4peace said:
Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD Tom wrote:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
Hi Tom

"it doesn't matter what the table column is set to"

if you are using a query to expost, the equation should take priority as
the data is converted to text. You need to export the query, NOT the table

if importing to Excel, even though it is text, Excel will interpret it
correctly as a number -- as should Access if you bring it back in

more ideas are in post to your previous response

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
I just realized that I still have the default windows setting for decimals to
3, when I changed it back to 2 the export of the file went back to only
extracting 2 decimals. It sure looks like access is using the windows
setting to export the table, and it doesn't matter what the table column is
set to. When I do the export through the menus and can see the data before
it exports it out to the .txt file it shows there are 3 decimals but when you
look at the exported file there are only 2 decimals exported. I don't know
what to do now unless there is a different way I could do the backup without
making a complete backup of the whole database. Do you have any other ideas.
Tom

strive4peace said:
Hi Tom,

can you post the SQL for the query you are using to export?

from the menu when you are in design or datasheet view of the Query -->
View, SQL

if you are exporting, you need to use acExportDelim, not acimportdelim

can you explain why you are exporting? What is being done with the
exported information?



Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
Now here's a funny thing when I do the import from the file menu and select
the exported .txt file it works fine, but when I do it with the
docmd.transfertext acimportdelim command it comes up with the error about the
field not being in the table. I've set the headers off in both the export
and the import command.

CD

:

Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD Tom wrote:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 
Hi Tom,

well, you asked for ideas, so here is the most important thing I can
tell you:

your data is not normalized. Setting up structures correctly in Access
is very important -- your data structure is analogous to the foundation
of your house -- if there is a crack, you need to repair it before
building any more -- Access is no different.

to help you understand Access a bit better, send me an email and request
my 30-page Word document on Access Basics (for Programming) -- it
doesn't cover VBA, but prepares you for it because it covers essentials
in Access. One of the sections in this document discusses normalizing
data (setting it up efficiently)

Be sure to put "Access Basics" in the subject line so that I see your
message...

While you may have structured your data to be 'easier' to communicate
with flat files, this will not serve you well in the long run -- much
better to do it right to begin with.

It is a little extra effort to export and restore from flat files once
you do have it set up correctly (and we can help you), but you can only
use so much duct tape and bailing wire before you need a real fix.

After you read the Access Basics document and reset up your structures,
we can help you with converting your existing data as well as achieving
your goals.

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
I'm using the export as a backup, there is a menu option to backup data, this
in turn exports all the data in the tables to the .txt files. This is a
scoring system that is used during matches, the users use the backup to
backup the data for the current match. If they ever need to go back to a
given match then can do the restore, the program will delete the rows from
the current tables and restore them back to the match they wish to see. I
also have the users send me the .txt files if they have any problems. I then
just restore them and can check to see what there problem is.
Here is the sql of the query, I've only tested with the first time1, like is
said before the extract seems to be working fine, it's now when I try and
restore the data that I get the error regarding the field "5" not in table,
I've set the export to have no headings and have setup a spec. file for the
import but it is still coming up with the same error.
SELECT Scores.SASS_number, Scores.Shoot_date, Scores.ShooterNumber,
Scores.Division, CDbl(Format([time1],"#,##0.000")) AS Time1_, Scores.Rank1,
Scores.Misses1, Scores.Penalties1, Scores.Bonus1, Scores.TTime1,
Scores.Time2, Scores.Rank2, Scores.Misses2, Scores.Penalties2, Scores.Bonus2,
Scores.TTime2, Scores.Time3, Scores.Rank3, Scores.Misses3, Scores.Penalties3,
Scores.Bonus3, Scores.TTime3, Scores.Time4, Scores.Rank4, Scores.Misses4,
Scores.Penalties4, Scores.Bonus4, Scores.TTime4, Scores.Time5, Scores.Rank5,
Scores.Misses5, Scores.Penalties5, Scores.Bonus5, Scores.TTime5,
Scores.Time6, Scores.Rank6, Scores.Misses6, Scores.Penalties6, Scores.Bonus6,
Scores.TTime6, Scores.Time7, Scores.Rank7, Scores.Misses7, Scores.Penalties7,
Scores.Bonus7, Scores.TTime7, Scores.Totaltime, Scores.TotalRank,
Scores.Matchfinal, Scores.ClassFinal, Scores.Scored, Scores.Shootorder1,
Scores.Shootorder2, Scores.Shootorder3, Scores.Shootorder4,
Scores.Shootorder5, Scores.Shootorder6, Scores.Shootorder7, Scores.Extra_1,
Scores.Extra_2, Scores.Extra_3, Scores.Extra_4, Scores.MatchFee,
Scores.CKBox1, Scores.CKBox2, Scores.CKBox3, Scores.CKBox4, Scores.CKBox5,
Scores.CKBox6, Scores.CKBox7, Scores.DNFMDQ, Scores.Horsenumber
FROM Scores;

strive4peace said:
Hi Tom,

can you post the SQL for the query you are using to export?

from the menu when you are in design or datasheet view of the Query -->
View, SQL

if you are exporting, you need to use acExportDelim, not acimportdelim

can you explain why you are exporting? What is being done with the
exported information?



Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD said:
Now here's a funny thing when I do the import from the file menu and select
the exported .txt file it works fine, but when I do it with the
docmd.transfertext acimportdelim command it comes up with the error about the
field not being in the table. I've set the headers off in both the export
and the import command.

CD

:

Hi Tom,

use a query to do your export

field --> Fieldname_ : format([fieldname],"#,##0.000")

where the columnname is the fieldname with an underscore after it --
still looks like the fieldname but is actually different ;)


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



CD Tom wrote:
I posted an earlier question regarding the extracting for a table that has
number fields with 3 decimals, and when you extract the table to a .txt file
only 2 decimals will come across. When you do the extract using the export
command you can see that the field shows the 3 decimals but after the extract
only 2 are in the .txt file. The only way I was able to resolve this problem
was to go into the control panel of Windows XP and select the date,time,
language settings the the regional and language option and customize the
Number section to 3 decimals. Now for my question is there any way to change
that automatically using code. I have customers using the export function to
backup there data and if they have a problem to send me the backed up .txt
files. I would like to be able to change the number and then change it back
after the export is done. Hopefully someone out there will have some kind of
an answer.
Thanks in advance for any help.

CD Tom
 

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

Back
Top