Re: Returning to previous record on Scrolling form

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Brian" <Brian@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:76B2FBB0-0D4C-4229-BAA3-F65383DA7667@xxxxxxxxxxxxxxxx
I have a very long form with sometimes hundreds of records. For each
record,
there is a text box where the user can enter a quantity to be
added/deleted
to the existing quantity. Once the quantity has been added/deleted, the
form
requeries so that the quantity displayed is now accurate.

Since the form is so long, I want a way for the form to return to the
record
that the user just updated. In Access 2003, I used this code:

dim rst as recordset
dim IntKeyVal as string
IntKeyVal = idx_IDNumber
Application.Echo False

<<<other VBA code here to add/delete from existing quantity>>>

set rst = me.recordsetclone
rst.findfirst IntKeyVal
me.bookmark = rst.bookmark
Application.Echo True

This worked well in Access 2003, but does not work in Access 2007. Access
2007 returns an error that says "Run Time Error '3001' Invalid Argument"
and
when I debug, highlights the rst.findfirst IntKeyVal line. I should point
out that the IntKeyVal value is correct (when I hover over the line to see
the value).

Any help anyone can give would be most appreciated.

Brian


If you're using DAO, try explicitly typing the rst variable:

dim rst as DAO.recordset


Carl Rapson


.



Relevant Pages

  • Re: DAO Recordset
    ... On occasion I have seen where I went to open a database and it wouldnt open, ... >> set rst as DAO.Recordset ... > If you're only going to use one reference to CurrentDb, ... > Dim rst As DAO.Recordset ...
    (microsoft.public.access.forms)
  • RE: OpenRecordset Error
    ... It seems that when you use a query instead of a table you have to create the ... Dim rst As DAO.Recordset ... Steve - from a land down under ... Set rst = CurrentDb.OpenRecordset ...
    (microsoft.public.access.formscoding)
  • Re: Step through a table
    ... I have also broken down the database ... Dim rst as RecordSet ... Set rst = db.OpenRecordSet ... > Does the ID for the record match MyID? ...
    (microsoft.public.access.modulesdaovba)
  • Create a list that is a string.
    ... Dim rst As Recordset, dbs As Database, qdf As QueryDef ... Set dbs = CurrentDb ... Set rst = qdf.OpenRecordset ... or higher, have Service Pack 2, and have the pop-up blocker on for MS XP ...
    (microsoft.public.access.modulesdaovba)
  • Re: Recordcount Problem
    ... code to display the number of records returned ... Dim rst As DAO.Recordset ... Dim lngCount As Long ... Set rst = Me.RecordsetClone ...
    (microsoft.public.access.formscoding)