Re: Edit Method in VB

From: Dirk Goldgar (dg_at_NOdataSPAMgnostics.com)
Date: 09/29/04


Date: Wed, 29 Sep 2004 00:46:39 -0400


"Jill Marlow" <J_Marlow@msn.com.(donotspam)> wrote in message
news:B5FDAD02-1F2D-487F-B2E5-0AA3448794CC@microsoft.com
> I used to edit records in a module by using a tbl.Edit method. I
> created a new database in Access XP and tried to use the Edit method,
> but it doesn't recognize it. I checked the Microsoft DAO 3.6 library
> under Tools, References, but it still doesn't work. I see a
> reference to the Edit Method in the Visual Basic Help, complete with
> an example, but it won't work in my database. Is there some other
> library that needs to be checked? If not, is there an alternate
> method that can be used to edit a record in a recordset?

Do you do something like ...

    Dim tbl As Recordset
    ' ...
    Set tbl = CurrentDb.OpenRecordset("Some Table or Query")
    ' ...
    tbl.Edit

... and the VB editor tells you there is no such method?

If so, it's probably not a matter of another library that needs to be
checked, but rather one that needs to be *unchecked*. Specifically,
either change your Dim statement to

    Dim tbl As DAO.Recordset

or open the References dialog again and remove the check mark next to
Microsoft ActiveX Data Objects 2.x Library. The ADO library also
defines a Recordset object, which doesn't have an Edit method, and
Access was thinking that was the type of recordset you were declaring.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)


Relevant Pages

  • Re: Dim as database Compile error
    ... Database is a DAO object. ... With any code module open, select Tools | References from the menu bar, ... Microsoft DAO 3.6 Object Library, ... For example, to ensure that you get a DAO recordset, you'll need to ...
    (microsoft.public.access.formscoding)
  • Re: Dim Statements
    ... Database and TableDef ... With any code module open, select Tools | References from the menu bar, ... For example, to ensure that you get a DAO recordset, you'll need to ... Dim rsCurr As ADODB.Recordset) ...
    (microsoft.public.access.formscoding)
  • Re: Form View using snapshot?
    ... Allen Browne - Microsoft MVP. ... controls instead of trying to modify the type of recordset the form uses. ... The add and edit work fine. ...
    (microsoft.public.access.formscoding)
  • Re: Assign a table field value to a variable
    ... use the Menu Tools / References ... ... I am not sure why you created the Recordset in the first ... Dim db As database, rst As DAO.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: Run-time error 3197
    ... I am in the process of creating a new table and database. ... The Microsoft Access database engine stopped the process ... Between the time you used the Edit method and the Update ... How local is your recordset usage? ...
    (microsoft.public.access.forms)