[AccessD] ERROR going to first record Sometime?

Gustav Brock Gustav at cactus.dk
Tue Jan 2 09:26:12 CST 2007


Hi Mark

I think all you need is not to Refresh the subform but to Requery it.

/gustav

>>> markamatte at hotmail.com 02-01-2007 16:14 >>>
Hello All,

I'll try to ask this a simple as possible.  I have a form in A97 that has a 
combo box and a subform.  The subform is continuos and is filtered anytime 
the combo is updated.  If I was on the 4th record on the subform and I 
changed the combo...when the sub refreshed it would also be on the 4th 
record.  I needed to go back to the first record each time.  So I added the 
code below:

Dim rs As DAO.Recordset
Set rs = sfrmView.Form.RecordsetClone
rs.MoveFirst
sfrmView.Form.Bookmark = rs.Bookmark
NoRecord:
Set rs = Nothing
**********
This works fine if I move to a different record each time before changing 
the combo.  If I just change the combo I get an error during the refresh of 
the subform "Runtime error 3020, Update or CancelUpdate without AddNew or 
Edit".  The line of code is on the 'Form_BeforeUpdate' of the subform.  If I 
use the code above...What would I add to determine if I were already on the 
first record...or what are other approaches to the same solution?

Thanks and Happy New Year,

Mark A. Matte





More information about the AccessD mailing list