Form.Recordset bug?

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi

Can anyone tell me if the following is a confirmed bug?

I have a subform which is set to 'continuous form'. Each control has a
function for its double click event. In the function I capture the primary
key of the record that has been double clicked and use it to build a filter
for another form with code such as...

strFilter = "[" & form.recordset.fields(0).name & "] = " &
form.recordset.fields(0).value

This works perfectly unless I double click on record X, then move back to
the subform and double click on record X again without having moved to
another record first.

Although form.currentrecord and the like yield results,
form.recordset.fields(0).value yields 'no current record'.

I have implemented a workaround (get the value from a hidden control rather
than the recordset), but this doesn't appear to be 'correct behaviour' -
some parts of Access know what record is currently selected and other parts
do not.

TIA

Paul
 
This was one of the MOST frustrating problems I've had so far. Finally
figured out a way around it, thought I never did find out why it
happens. It only happens on ONE of my forms BTW, all my other
continuous are fine. Never did find out if it was a bug, but I assume
it is.

Basically, it works like this. I try to grab a field from the subform's
recordset. If I get one of two errors, I know I have this 'no current
record' problem. I then use the CurrentRecord property to 'move' around
the subform's recordset to reset the bookmark.

Here is the basic code I use. I am not sure this handles all cases,
especially with very long forms, as far as the 'scrolling' problem goes.

iCurrent = Me.subContinuousForm.Form.CurrentRecord - 1
iCount = R.RecordCount

'-- exit if there are no records to delete
If (iCount = 0) Then Exit Sub

On Error Resume Next
Dim s As String
s = Me.subContinuousForm.Form.Recordset("some_id")
'-- if we have one of the specific errors trying to read this, then
'-- we know we have the 'no current record' issue
If (err.Number = 13) Or (err.Number = 3021) Then
Call Me.subContinuousForm.Form.Requery
Call Me.subContinuousForm.Form.Recordset.MoveFirst
If (iCount > 1) Then
Call Me.subContinuousForm.Form.Recordset.Move(iCurrent)
End If
End If

Andrew Backer
-[ abacker at comcast .dot. net ]-
 
Back
Top