I have a subform and a main form.
The sub is a datasheet view of the main.
I have coded so that when I click the record selector(not the navigation button) in the subform, the main form sets itself to the same record number.
There are 842 records. When I click the subform it works fine, until I get to a record number over 450, then I get an error saying it is an invalid bookmark - runtime error 3159. I checked the underlying table and records > 450 are not noticably different than the lower numbered recs. All were imported from Excel at the same time, so, I doubt there are typos.
It seems like sometimes, I can got to record 479, someimes only 450.
here's the code...
based on experience, it almost feels like there is some conflict with a variable/recordset already being open, or something overloading, overflowing, etc.
I have another button that jumps 10 records at a time, and using that code, I can go over the problem records mentioned above, without any errors.
P.S. if you have tons of time, and this strikes you as a wrong-headed, unecessarily complex approach, I wouldn't mind hearing about that, too.
Thanks,
Robert
The sub is a datasheet view of the main.
I have coded so that when I click the record selector(not the navigation button) in the subform, the main form sets itself to the same record number.
There are 842 records. When I click the subform it works fine, until I get to a record number over 450, then I get an error saying it is an invalid bookmark - runtime error 3159. I checked the underlying table and records > 450 are not noticably different than the lower numbered recs. All were imported from Excel at the same time, so, I doubt there are typos.
It seems like sometimes, I can got to record 479, someimes only 450.
here's the code...
Code:
Private Sub Form_Click()
' detect clicking into subform "MAIN3" and update main to sub
Dim transet As DAO.Recordset
Dim rex As Long
Dim curry As Long
curry = 0
Dim m3set As DAO.Recordset
Set m3set = Me.Form.RecordsetClone
m3set.MoveLast
m3set.MoveFirst
rex = m3set.RecordCount
'MsgBox (rex)
curry = Me.Form.CurrentRecord
'MsgBox (curry)
m3set.AbsolutePosition = curry - 1
Set transet = Me.Parent.RecordsetClone
'Parent.SetFocus
Me.Parent.Bookmark = m3set.Bookmark
End Sub
based on experience, it almost feels like there is some conflict with a variable/recordset already being open, or something overloading, overflowing, etc.
I have another button that jumps 10 records at a time, and using that code, I can go over the problem records mentioned above, without any errors.
P.S. if you have tons of time, and this strikes you as a wrong-headed, unecessarily complex approach, I wouldn't mind hearing about that, too.
Thanks,
Robert