here it is just to clarify
Dim db As DAO.Database
Dim Rst3 As DAO.Recordset
Set db = CurrentDb
******************
Set Rst2 = db.OpenRecordset(StrSelectPrior)
Rst2.MoveLast
Me.TxtPrior.Value = Rst2.RecordCount
This section works
***********************
this doesnt
Set Rst3 = db.OpenRecordset("Myqueryindatabase")
the reference section has the dao reference checked.
kind regards
Peter
"PC Datasheet" <nospam@nospam.spam> wrote in message
news:1u03d.5900$n16.703@newsread2.news.atl.earthli nk.net...[color=blue]
> Double Check! Do you have "DAO" in front of database? Do you have the Set[/color]
Db[color=blue]
> statement as I showed?
>
> Steve
> PC Datasheet
>
>
> "Peter Bailey" <peterbailey@andaluz.fsbusiness.co.uk> wrote in message
> news:cii1j2$sab$1@news8.svr.pol.co.uk...[color=green]
> > sorry I didnt mention those they are defined as you set out below.
> > "PC Datasheet" <nospam@nospam.spam> wrote in message
> > news:e7%2d.6012$mb6.2386@newsread3.news.atl.earthl ink.net...[color=darkred]
> > > Peter,
> > >
> > > You haven't defined the object variable "db". Add the following as[/color][/color][/color]
lines[color=blue]
> 2[color=green][color=darkred]
> > > and 3:
> > > Dim Db As DAO.Database
> > > Set Db = CurrentDb()
> > >
> > > --
> > > PC Datasheet
> > > Your Resource For Help With Access, Excel And Word Applications
> > >
resource@pcdatasheet.com
> > >
www.pcdatasheet.com
> > >
> > >
> > > "Peter Bailey" <peterbailey@andaluz.fsbusiness.co.uk> wrote in message
> > > news:cihtaq$rh7$1@newsg3.svr.pol.co.uk...
> > > > I have used recordsets in my query but only referenceing an sql[/color][/color][/color]
string[color=blue][color=green]
> > and[color=darkred]
> > > > not a query. I tried to reference a query that was created but it[/color][/color]
> falls[color=green][color=darkred]
> > > > over.
> > > >
> > > > I have that works:
> > > > dim Rst2 as DAO.Recordset
> > > > Set Rst2 = db.OpenRecordset(StrSelectPrior)
> > > > Rst2.MoveLast
> > > > Me.TxtPrior.Value = Rst2.RecordCount
> > > >
> > > > This doesnt:
> > > > Dim Rst3 as DAO.Recordset
> > > > Set Rst3 = db.OpenRecordset("Myexistingquery")
> > > >
> > > > it falls over on the last line by saying object not found.
> > > >
> > > > Your help would be much appreciated.
> > > >
> > > > Regards
> > > > Peter
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]