Recordset MoveNext Problem. Please Help.

  • Thread starter Thread starter CK NG
  • Start date Start date
C

CK NG

Hi All,
I having a problem with using the recordset .MoveNext in access.
I have a form and using Combo Box to select and update data to certain
table. But i having a problem with using .MoveNext function. Eventhough i
able to detect the location where the data should be updated. When i use the
..MoveNext Function to access it, it always updated the wrong row of data.
Can anyone advice how to solve this problem? Thanks.

Here is the partial of my code:

'ProductValue is location for the data wish to update.

rsProducts.MoveFirst
For I = 1 To (ProductValue - 1)
rsProducts.MoveNext
'MsgBox "Product Value", vbOKOnly, I
Next I

rsProducts.Edit
rsProducts!StockUnit = UpdatedStockUnit

rsProducts.Update
rsProducts.Close

Your help is very appreciated. Thanks.

Best Regards,
C.K.
(e-mail address removed)
 
Hi C.K.,

You should really post this in an Access newsgroup, not here. Firstly
because it has nothing to do with Word but, more importantly, from your
point of view, that is where the Access experts are likely to be found.

That said, my Access skills are rusty but all I have is questions for you as
there is nothing in your posted code to suggest either what should happen or
what is happening. So what exactly happens? Does your msgbox tell you
anything? Are the MoveNexts doing anything? Which wrong record is being
updated - the one after the correct one? Or the one before? Or the first
one? Or the last one? Is the recordset in ProductValue order? Should it be?

Also, are you using DAO or ADO? And anything else that might give me a
fighting chance of identifying your problem.

And wouldn't a Seek be a better way of identifying the right record?
Walking the recordset from the beginning every time isn't usually an
effective way of working..
 
It sounds as if your question is about Access. This newsgroup is for new
users of Microsoft Word.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Hi Ck,
I having a problem with using the recordset .MoveNext in access.
I have a form and using Combo Box to select and update data to certain
table. But i having a problem with using .MoveNext function.
Ummmm. This is a WORD.Newusers newsgroup? Perhaps you should ask this in
an ACCESS group dedicated to programming (VBA or DAO or ADO)

FWIW I don't understand how you're using the MoveNext function in this
context. I should rather think you ought to be able to access the record
directly, using a primary key.

but in any case, I'd check whether the records are sorted the same way
as they appear in your list vs. the order they're in in the recordset,
if you're always getting the "wrong" record, and there's no pattern to
it.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
 
Back
Top