Re: Use ADO in Access 2000?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: dj (dj_at_discussions.microsoft.com)
Date: 06/16/04


Date: Wed, 16 Jun 2004 05:01:01 -0700

Agreed. Yes, this looks like what I was trying to do.
I've never had a need to use the CurrentProject object before
and it was the actual connection bit that I was stuck on.
Thanks for the help!
Cheers,
dj

"Nick Coe (UK)" wrote:

> There are some things you can _only_ do with DAO. ADO has
> some very nice and neat ways to do things but overall DAO
> still has the edge in terms of overall functionality.
> Especially since MS started to deprecate bits like JDO along
> with jet, that was a real blow.
>
> Is this what you're after:-
>
> ******* Air Code ************
>
> Public Function testadoproc()
>
> Dim rst As ADODB.Recordset
> Dim cn As ADODB.Connection
>
> Set cn = CurrentProject.Connection
> Set rst = New ADODB.Recordset
> rst.Open "tblBlog", cn, adOpenKeyset, adLockOptimistic,
> adCmdTable
>
> With rst
>
> 'do stuff
>
> End With
>
> rst.Close
> rst = Nothing
> cn = Nothing
>
> End Function
>
> *************************
>
> CurrentProject is part of Application so that full syntax
> (in theory) is Application.CurrentProject etc etc.
>
> CodeProject returns the connection to wherever the code
> itself is running - use in Library databases etc...
>
>
> --
> Nick Coe (UK)
> www.alphacos.co.uk
>
> ---
>
> "dj" <dj@discussions.microsoft.com> wrote in message
> news:3620E8E4-028C-4188-A97E-9A8C593E45FE@microsoft.com...
> > I have Full Access rights on the folder the MDB file is
> in.
> > DAO is still best for Jet dbs? Is this why I can't find a
> single example
> > of connecting to the current Access (2000) database using
> ADO?
> > I thought ADO was the default data access technology for
> Access 2000 and up.
> > Or is that thought really geared toward using Access as a
> front-end for SQL Server?
> > In any case, I think I'll take your advice and 'fall back'
> to DAO on this one.
> >
> > Thanks for the input.
> > Cheers,
> > dj
> >
> > "Douglas J. Steele" wrote:
> >
> > > What permissions do you have on the folder in which the
> MDB exists? You must
> > > have Read, Write and Delete.
> > >
> > > And why are you trying to avoid DAO? For Jet databases
> (i.e.: MDB files),
> > > it's still the better way.
> > >
> > >
> > > --
> > > Doug Steele, Microsoft Access MVP
> > > http://I.Am/DougSteele
> > > (no e-mails, please!)
> > >
> > >
> > > "dj" <dj@discussions.microsoft.com> wrote in message
> > >
> news:0EB7C8B4-7659-4D1B-9A1C-F8E52E93EDCD@microsoft.com...
> > > > This seems so simple, yet I can't seem to work it out.
> > > > I have an Access 2000 database open.
> > > > I want to connect to the database and append to a
> table using ADO.
> > > > When I try to open the ADO Connection, I get the error
> message 'The
> > > database has been placed in a state by user 'Admin' on
> machine 'MYMACHINE'
> > > that prevents it from being opened or locked.'
> > > >
> > > > I experimented with the Mode settings of the
> Connection object to no
> > > avail.
> > > > I have a reference set to the ADO 2.8 library, no DAO
> reference - I'd like
> > > to avoid DAO.
> > > > Can anyone tell me what I'm missing?
> > > >
> > > > TIA,
> > > > dj
> > >
> > >
> > >
>
>
>



Relevant Pages

  • Re: Need help opening ADO recordset.
    ... So I have been forced to try ADO. ... Dim cnn As ADODB.Connection ... Dim rst As ADODB.Recordset ... Set cnn = CurrentProject.Connection ...
    (microsoft.public.access.modulesdaovba)
  • Re: learning ADO; finding a record
    ... > matching key and then extract the value of another field in that ... > tblTasks, what is the efficient ADO code to find that record? ... > Dim rst As ADODB.Recordset ...
    (microsoft.public.access.formscoding)
  • Re: using LIKE operator in SQL
    ... > Dim rst As Recordset ... it's lower in precedence than ADO. ... > There's a Recordset object in both the ADO and DAO models. ... >> also returns Type Mismatch error on the last line ...
    (microsoft.public.access.queries)
  • Re: using LIKE operator in SQL
    ... Dim rst As Recordset ... Dim rst As DAO.Recordset ... it's lower in precedence than ADO. ... There's a Recordset object in both the ADO and DAO models. ...
    (microsoft.public.access.queries)