Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What to do after .moveprevious

Status
Not open for further replies.

ViperD

IS-IT--Management
May 1, 2003
27
US
Here is my code:

With rstClone
.MovePrevious
numPrevTotRec = Me.Total_Reimbursement
.MoveNext
End With

Is there something that I need to do after the .MovePrevious command so that the Me.Total_Reimbursement is reading the new (previous) record.
 
I don't necessarily want to go back to the first record. I have the .MoveNext if there to go back to the origional record. The problem is that after the .MovePrevious I don't seem to be reading that data.
 
If Me.Total_Reimbursement is on a form then you will not see it until you do a Me. Repaint to update the screen with the underlying database
elseif

It's a field in which case it should be !Total_Reimbursement


Hope that helps


Mike
 

The problem is that after the .MovePrevious I don't seem to be reading that data.

If your starting pos is ZERo - it has nowhere to move,
this is why MoveFirst will actually mooove it
 
Viper,

I am experiencing a similar issue and I have been monitoring this thread. It appears that you had received your code from an earlier posting that you had put up in regards to this. In the earlier post there was a line that refered to "put code to obtain value here" or something along those lines. If I understand your question on this posting, that is what you are trying to get at.

I am basically trying to do what you are doing and I can get the the record pointer to move up by one record by setting the me.bookmark = .rstclone.bookmark after the .moveprevious .

I can then set a variable equal to the value of the field I want. My problem is then returning to the original line so I can set a field equal to that variable. I too do not wish to go the first record in my record set.

If you or anyone else can be of help on this I would be very grateful.
 
OK, fellas, I am trying hard to guess what is up here
But it is hard to get why is new record would be previous

One suggestion is that when you .MoveLast - you are checking recordset out to the last record and then
If Not Rs(0)
.MovePrevious could do something.

You can also post way you opening Recordset, could be problem there

TIA
 
I can't speak for ViperD but what I'm doing is entering a new record and on entry to a specific field I want to look at a different field in the previous record. I am trying to pull an amount from a specific field ("Current Amount")in the previous record and populate the field "Previous Amount" in my new record.

I am opening the data set as follows:

Dim rstClone As DAO.Recordset

set rstClone = Me.Recordsetclone
 
First of all

set rstClone = Me.Recordsetclone ??? What is that ?

You MUST have
Set rstClone = DB.OpenRecordset ("Your Query or Table")

With rstClone
rstClone.MoveLast
rstClone.MoveFirst or where you want

What is Recordsetclone ?

TIA
 
my bad, it is DAO

set rstClone = Me!Recordsetclone
might fix it
but what is the Recordsetclone anyway ?


 
It's supposed to be a method to open another instance of whatever your current recordset is while using a form.

You can use it to creat a "clone" of whatever you're looking at. If you used a select statement or table reference as your data source for a form it should give you the same recordset to work with but as a separate instance.

You are supposed to be able to use it for navigating in records. When the "clone" is opened the record pointer is supposed to be in the same place as you're original data, hence if you are on the last record and you want to look at the one prior you should be able to do a .MovePrevious.

From what I've read you should also be able to use it for looking at the previous record so you can pull values to use in your current record.

It seems that you need to use the .bookmark property with it for proper navigation but I haven't been able to get that to work real effectively.

By the way,

It didn't like the Me!Recordsetclone solution.
 
Thanks for explanation,
but i still don't see your recordset OPEn anywhere

What is Recordsetclone ?
How is Me.Recordsetclone opening anything ?
 
My form (Me) already has an open recordset. RecordSetClone is making a working copy of the already open recordset so it can be used for navigation.
 
Doesn't your "Me" suppose to have a control to display your Recordset result ?
Me.Recordsetclone seems like form has recordset...
Is this suppose to be Hidden recordset :) ???
 
Here is a link to what started this whole thing. Take a look at it.


thread705-577275 part where it says " 'code for obtaining value" is what this thread is all about. At least that's my assumption based upon ViperD's original question.
 
Let's forget whole thing !
We need to OPEN Recordset and display Result somewhere, right ?

Using reserved words like frm=Me isn't helping at all

Then how is Recordset suppose to work with
Set frm = Me
Set rstClone = frm.RecordsetClone

I am simply wanna scream !
WHAT IS frm.RecordsetClone
How can you set recordset as frm.RecordsetClone ?


TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top