Connecting Tech Pros Worldwide Help | Site Map

Use TransferText to update a field in table?

  #1  
Old September 4th, 2006, 01:25 PM
Jim M
Guest
 
Posts: n/a
I am trying to 'grab' a backend data path and filename from a text file
(to be used when updated front ends are installed by users). I store
this information by running:


DoCmd.TransferText acExportDelim, , "qExportBackEndPath",
Local_TxtFileName, True

qExportBackEndPath simply pulls the text field 'BackEndPath' from my
tblLocal, which has only one record containing a fields related to
upgrading:

SELECT tblLocal.BackEndPath
FROM tblLocal
WHERE (((tblLocal.ID)=1));

This exports a text file which contains:

"BackEndPath"
"Z:\MyDataFile.mdb"

When I try to retrieve this with:

DoCmd.TransferText acImportDelim, , "qImportBackEndPath",
Local_TxtFileName, True

I always get a new record in my tblLocal, which is only supposed to
have one record. I've tried a few variations on the query, e.g.
restricting it to (((tblLocal.ID)=1)), but it still adds a record. I
have resorted to 1) creating a temporary table with the transfertext
method, 2) running an update query with it's data to change tblLocal,
3) then deleting the temporary table.

Is there another, more elegant way to do this. Am I barking up the
wrong tree using transferText?

Thanks!
Jim M

  #2  
Old September 4th, 2006, 01:45 PM
Bob Quintal
Guest
 
Posts: n/a

re: Use TransferText to update a field in table?


"Jim M" <mandala@rci.rutgers.eduwrote in
news:1157373140.056818.154340@m79g2000cwm.googlegr oups.com:
Quote:
I am trying to 'grab' a backend data path and filename from a
text file (to be used when updated front ends are installed by
users). I store this information by running:
>
>
DoCmd.TransferText acExportDelim, , "qExportBackEndPath",
Local_TxtFileName, True
>
qExportBackEndPath simply pulls the text field 'BackEndPath'
from my tblLocal, which has only one record containing a
fields related to upgrading:
>
SELECT tblLocal.BackEndPath
FROM tblLocal
WHERE (((tblLocal.ID)=1));
>
This exports a text file which contains:
>
"BackEndPath"
"Z:\MyDataFile.mdb"
>
When I try to retrieve this with:
>
DoCmd.TransferText acImportDelim, , "qImportBackEndPath",
Local_TxtFileName, True
>
I always get a new record in my tblLocal, which is only
supposed to have one record. I've tried a few variations on
the query, e.g. restricting it to (((tblLocal.ID)=1)), but it
still adds a record. I have resorted to 1) creating a
temporary table with the transfertext method, 2) running an
update query with it's data to change tblLocal, 3) then
deleting the temporary table.
>
Is there another, more elegant way to do this. Am I barking up
the wrong tree using transferText?
>
Thanks!
Jim M
>
TransferText will always append a new record. Just clear the
existing one before you run the import, Docmd.runsql "delete *
from qImportBackEndPath;"

You could alternatively open the file using the basic Open() and
get() functions

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

  #3  
Old September 6th, 2006, 03:35 AM
Jim M
Guest
 
Posts: n/a

re: Use TransferText to update a field in table?


Bob, Thanks,

Can you tell me where to find documentation on the Open() and Get()
functions? My AccessXP VBA help is useless...

Jim M

Quote:
TransferText will always append a new record. Just clear the
existing one before you run the import, Docmd.runsql "delete *
from qImportBackEndPath;"
>
You could alternatively open the file using the basic Open() and
get() functions
  #4  
Old September 6th, 2006, 05:25 PM
rquintal@sympatico.ca
Guest
 
Posts: n/a

re: Use TransferText to update a field in table?



Jim M wrote:
Quote:
Bob, Thanks,
>
Can you tell me where to find documentation on the Open() and Get()
functions? My AccessXP VBA help is useless...
>
Jim M
>
try http://www.garybeene.com/vb/tut-file.htm

Anybody else have any suggestions? I learned open() get() put() over 20
years ago.
Quote:
>
Quote:
TransferText will always append a new record. Just clear the
existing one before you run the import, Docmd.runsql "delete *
from qImportBackEndPath;"

You could alternatively open the file using the basic Open() and
get() functions
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
duplicates query help & strategy for update queries with SetWarnings = False ARC answers 16 September 23rd, 2007 12:15 AM
How to speed up a code loop with INSERT INTO query? SaltyBoat answers 8 August 3rd, 2007 08:55 PM
Change field names to first row of table Bob answers 4 March 24th, 2007 05:45 PM
Exporting a table to a Tab delimeted Text File via code nunYa answers 1 November 13th, 2005 09:17 AM