Re: Append import data to existing record
- From: Bonnie <bonnielynnw@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 18 May 2005 05:38:13 -0700
Hi John,
AARRRGGGGHHHHH! Import to a table was where I began this journey, but I
really liked the idea of linking to the text file. Rather than go back and
recreate the table and the import specs and the macro, I'd like to try your
code below. However, I need to verify which of the items below I need to
'customize' to my info. Such as:
Forms("MyForm").MySubForm.Form.Field1.Value = _rstR.Field1.Value
(I'm sure I need to exchange Field1 with my actual field name but what about
the ("MyForm").MySubForm.Form? Do I put my form names here anywhere? And, to
clarify, my access field name goes into Field1 for
MySubForm.Form.Field1.Value and the import text file field goes into Field1
for _rstR.Field1.Value, correct?)
forms(0).frmsub1.Form.ItemName.Value
(Do I make any changes to the above line?)
Also, where am I to put the code? Into an OnClick event procedure on a
button on my form?
Thank you again for staying with this thread, I am truly learning great
stuff on this project. I hope I'm not frustrating you or imposing too much
but getting walked through this is FANTASTIC!!!
--
Bonnie
"John Nurick" wrote:
> Bonnie,
>
> I;m sorry. I've been carried away by enthusiasm and forgot one of the
> little gotchas of the the Jet database engine used by Access. For some
> reason it gets confused when it's asked to update one (updatable) table
> or query with values from a non-updatable table or query - even though
> you're not trying to change the latter at all.
>
> Unfortunately, text files fall into the "non-updatable" category. ISAM,
> by the way, stands for Indexed Sequential Access Module, which doesn't
> mean much to me.
>
> The official work-round, at
> http://support.microsoft.com/default.aspx?scid=kb;en-us;824159 is to
> import the text file into an Access table, and then to use that table in
> the update query. (You can convert your qSARFromTxtI into an append
> query to do the importing smoothly.)
>
> An alternative - probably neater given that there's only the one record
> in the text file - is to write VBA code that uses recordset operations
> to read the data from the text file and update the subform table. The
> sequence would be something like this:
>
> 'Open a recordset on qSARFromTxtI
> Dim rstR As DAO.Recordset
> Set rstR = CurrentDB.OpenRecordset("qSARFromTxtI")
>
> 'Update the values in the subform
> Forms("MyForm").MySubForm.Form.Field1.Value = _
> rstR.Field1.Value
> Forms("MyForm").MySubForm.Form.Field2.Value = _
> rstR.Field2.Value
>
> rstR.Close
> forms(0).frmsub1.Form.ItemName.Value
>
>
>
>
>
.
- Follow-Ups:
- Re: Append import data to existing record
- From: John Nurick
- Re: Append import data to existing record
- References:
- Append import data to existing record
- From: Bonnie
- Re: Append import data to existing record
- From: John Nurick
- Re: Append import data to existing record
- From: Bonnie
- Re: Append import data to existing record
- From: John Nurick
- Re: Append import data to existing record
- From: Bonnie
- Re: Append import data to existing record
- From: John Nurick
- Re: Append import data to existing record
- From: Bonnie
- Re: Append import data to existing record
- From: John Nurick
- Re: Append import data to existing record
- From: Bonnie
- Re: Append import data to existing record
- From: John Nurick
- Append import data to existing record
- Prev by Date: Why can't I delete the links to external tables?
- Next by Date: Run Time Error '2391.' Field "F1" not in destination table?
- Previous by thread: Re: Append import data to existing record
- Next by thread: Re: Append import data to existing record
- Index(es):
Relevant Pages
|