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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get value of field from datasheet

Status
Not open for further replies.

Brambojr

Technical User
Oct 26, 2000
73
US
Simply put, I have a datasheet functioning as a subform. The user is entering questions, and I anticipate they will want to rearrange the order of these questions from time to time. I want them to be able to select a row and click a button on the main form with a "Move Up" type of action and then, of course, a "move down" will be there as well.

I know about .SelTop and all of that, the problem I have is in getting the info from the row directly above or beneath. Can anyone help me. I'm sure this is a simple fix, I'm just braindead tonight and all of my reference material is at work.

P.S. While the Position field is numeric, it is not a strict +1/-1 incrementing, so I must refer directly to the position field directly above or below the selected row(s).

Thanks to all!

Brambojr
 
HI

You can refer to the recordset of the sub from, then move up or down, using

Me.SubFormControlname.FORM.RecordsetClone.MoveNext

or

Me.SubFormControlname.FORM.RecordsetClone.MovePrevious

but I do not think this is what you are trying to do, you are trying to change the Sequence of the records as they appear in the sub form right?

To do this, the recordset of the subform needs to be ordered on (say) the Position Column, you need to update the rows to amend the Position Column and then requery the (sub)form,

you should be able to do this by manipulating the recordset of the sub form via Me.SubFormControlname.FORM.RecordsetClone

Do you need more info, or you VBA up to that?

You would probably need to use

.Edit
.Update
.MoveNext
.MovePrevious
.Bookmark

methods/properties of the recordset





Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hmmm . . . I hadn't really considered your solution. Do I need to do anything to start up the recordsetclone, or does it initialize immediately? I'll find out soon.

As for the rest of your email, I know that I need to change the values in the position field, the difficulty I ran into was in getting the value of the previous or next field, which it appears, you solved.

So, if you need assurances, without code here is the general run:

Set iNew to current selection's pos(ition) #
Set current selection pos # to new pos #
Set other field (up or down) = to iNew
then requery the form to resort by position again.

That should do it.

I appreciate your help and will try immediately.

I may post the code later, someone else may have the same question at some point.

Brambojr
 
Ok, now I have another mystery while working on this. Why can't it ever go smoothly?!?!?

In refering to the subform I am trying to get the .SelTop and the .SelHeight. I can get the .SelTop, but the .SelHeight will always give me 0. I have tried everything, but nothing seems to work.

Anyone have any insights?

Brambojr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top