Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
CK NG
 
Posts: n/a
Default Recordset MoveNext Problem. Please Help.

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.



  #2   Report Post  
Posted to microsoft.public.word.newusers
Tony Jollans
 
Posts: n/a
Default Recordset MoveNext Problem. Please Help.

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..

--
Enjoy,
Tony


"CK NG" wrote in message
...
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.





  #3   Report Post  
Posted to microsoft.public.word.newusers
Suzanne S. Barnhill
 
Posts: n/a
Default Recordset MoveNext Problem. Please Help.

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
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"CK NG" wrote in message
...
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.




  #4   Report Post  
Posted to microsoft.public.word.newusers
Cindy M -WordMVP-
 
Posts: n/a
Default Recordset MoveNext Problem. Please Help.

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 :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Normal.dot or formatting??? Jeff Menard Microsoft Word Help 5 March 20th 06 04:41 PM
Comments and tables problem in Word 2003 Ann Scharpf Microsoft Word Help 0 April 28th 05 04:38 PM
Problem with Textboxes Gary McGill Page Layout 10 March 31st 05 03:23 PM
Attaching Expansion Pack to Word Documents - Puzzling Problem Jose Microsoft Word Help 1 March 3rd 05 10:14 AM
Word User Network Problem Alpine Tom Microsoft Word Help 1 December 17th 04 04:51 PM


All times are GMT +1. The time now is 02:54 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"