Connecting Tech Pros Worldwide Help | Site Map

Use TransferText to update a field in table?

 
LinkBack Thread Tools Search this Thread
  #1  
Old September 4th, 2006, 12:25 PM
Jim M
Guest
 
Posts: n/a
Default Use TransferText to update a field in table?

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, 12:45 PM
Bob Quintal
Guest
 
Posts: n/a
Default 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, 02:35 AM
Jim M
Guest
 
Posts: n/a
Default 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, 04:25 PM
rquintal@sympatico.ca
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.