Adding a record from a text file

D

dhstein

I'm linking a text file to update a table. I search for a new ProductSKU and
if it is new, then I want to add a record and set the values from the text
file into the table.

This is the code I have

rsProducts.Seek "=", ![ProductSKU]
If rsProducts.NoMatch Then
MsgBox "This is a new item"
MsgBox ![ProductSKU]
With rsProducts
.AddNew
!ProductSKU = ![ProductSKU]
.Update
End With


The Msgbox displays the correct data from the text file, but I get a blank
record added to the table. Any ideas? Thanks.
 
T

Tom van Stiphout

On Thu, 4 Dec 2008 16:56:00 -0800, dhstein

You wrote:
!ProductSKU = ![ProductSKU]
That's to say: fill the ProductSKU field with whatever is in the
ProductSKU field. That's circular, isn't it?

Rather you would fill it with the value from the text file, as I have
previously suggested to you.

-Tom.
Microsoft Access MVP
 
D

dhstein

Tom van Stiphout said:
On Thu, 4 Dec 2008 16:56:00 -0800, dhstein

You wrote:
!ProductSKU = ![ProductSKU]
That's to say: fill the ProductSKU field with whatever is in the
ProductSKU field. That's circular, isn't it?

Rather you would fill it with the value from the text file, as I have
previously suggested to you.

-Tom.
Microsoft Access MVP

I'm linking a text file to update a table. I search for a new ProductSKU and
if it is new, then I want to add a record and set the values from the text
file into the table.

This is the code I have

rsProducts.Seek "=", ![ProductSKU]
If rsProducts.NoMatch Then
MsgBox "This is a new item"
MsgBox ![ProductSKU]
With rsProducts
.AddNew
!ProductSKU = ![ProductSKU]
.Update
End With


The Msgbox displays the correct data from the text file, but I get a blank
record added to the table. Any ideas? Thanks.
Thanks for your reply Tom. I'm sure you're right - I just don't know what the syntax is. Msgbox ![ProductSKU] displays the value I'm trying to set in the table - that is it shows the value that I'm reading fron the file. So the problem is then, what goes on the left side of the "=" sign in the assignment statement? Thanks.
 

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

Top