Problem moving to next rec

livvie

Registered User.
Local time
Today, 21:40
Joined
May 7, 2004
Messages
158
Hi
I have a form with 2 tabs in one tab there is a datasheet view of the table and the second tab has the details. The second tab displayes the details depending on which record you select in the first - this all works fine. My problem is that once I choose a record and look at it's details from there I want to move to the next record or previous record (numerically) without changing back to the first tab. Can this be done ir is it one funtionality or the other ?? Any help or ideas appreciated
 
Last edited:
When you move to a new record on either form, on the OnCurrent event save the unique record index, then use that index to move record position on the other tab's form to that index using a recordsetclone.

I call this "keeping two forms in sync."
 
Sounds like it will work - can you help me do it. I think my problem might be that I want to move thru all records in the table at this point so I mean the next id. I have code in the ONCurrent event that enables me to display the correct record depending on the rec selected in the first form does this make the recordset just that rec ?
 
Last edited:
NO, not a one record recordset, you're just moving to a row on a different form with the same unique ID, i.e., the same record.

Here's some code I use (I push a button to switch tabs):

private Sub XYZ_Click()
Dim sfrm As String
Dim PropID As Long
Dim rs As DAO.Recordset
On Error GoTo Err_Exit

'string name of the form program just came from
sfrm = Forms!frmMediateSettle!txtLastSubform
'PropID is the unique record ID for all records
If Forms!frmMediateSettle(sfrm).Form.PropID & "" = "" Then
Beep
MsgBox "USER CAUTION: Cannot transfer to parallel row. " & _
"A 'detailed' record has not been created for this asset/liability." & _
"It was added to the list during mediation/arbitration/settlement negotiations." & vbCr & vbCr & _
"Operation cancelled!", vbInformation, Me.Name
Exit Sub
End If

PropID = Forms!frmMediateSettle(sfrm).Form.PropID

'previous subforms recordset
Set rs = Forms!frmMediateSettle!sfrmInventoriedAssetsLiabilities.Form.RecordsetClone
'PropID uniquely identifies rows in all frmMediateSettle subforms
rs.FindFirst "PropID=" & PropID
If rs.NoMatch Then
MsgBox "UNEXPECTED ERROR: Unable to position to same row as previous subform", vbInformation, Me.Name
Exit Sub
End If
Forms!frmMediateSettle!sfrmInventoriedAssetsLiabilities.Form.Bookmark = rs.Bookmark
'now your're positioned on the same record you just left on another form
Exit_Exit:
Exit Sub
Err_Exit:
MsgBox "UNEXPECTED ERROR: (" & Err.Number & ") " & Err.Description
Resume Exit_Exit
End Sub

Goog Luck
 
Using this at least I am on the right record but I cannot move on to another one. I have tried rs.MoveNext ??
 
Last edited:
Are other records displayed? A posting of a view of the two screena might help diagnose what's going on.
 

Users who are viewing this thread

Back
Top Bottom