Use TransferText to update a field in table? 
September 4th, 2006, 12:25 PM
| | | 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 | 
September 4th, 2006, 12:45 PM
| | | 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 | 
September 6th, 2006, 02:35 AM
| | | 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
| | 
September 6th, 2006, 04:25 PM
| | | 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
| | | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | 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.
|