Re: Error 91 help required
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 07/07/04
- Next message: Joe: "Link to SQL server"
- Previous message: Allen Browne: "Re: Indexing Tables"
- In reply to: sandra_at_discussions.microsoft.com: "Re: Error 91 help required"
- Next in thread: Reggie: "Re: Error 91 help required"
- Reply: Reggie: "Re: Error 91 help required"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 7 Jul 2004 23:06:45 +0800
This error indicates either that you have a misspelling in your query, or
else that you have a parameter that is to be supplied at runtime.
If you run the query through the interface, it can call the Expression
Service to resolve references such as:
Forms!MyForm!MyTextBox
You cannot do that in DAO code.
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. <sandra@discussions.microsoft.com> wrote in message news:2840b01c46431$451efb90$a401280a@phx.gbl... > Thanks Reggie! > > But now I am getting 3061 error - "Too few parameters. > Expected 2" > > Any ideas? > > > >-----Original Message----- > >Sanda, You need to instantiate the database object > variable by using the set > >statement as you did for the recordset object. I also > changed the name of > >your variable. Not sure if CurrentDB is a reserved word, > but why take > >chances! > > > >Dim db As DAO.Database > >Set db = CurrentDb() > >Set rs = db.OpenRecordset("qryFirst") > >-- > >Reggie > > > >---------- > ><sandra@discussions.microsoft.com> wrote in message > >news:27e1c01c46402$41fa9570$a501280a@phx.gbl... > >> Help! > >> > >> I am getting an Error 91 code "Object variable or With > >> block variable not set" > >> > >> I get it on > >> Set rs = CurrentDb.OpenRecordset("qryFirst") > >> from the following code: > >> > >> Private Sub cmdSubmit_click() > >> > >> Dim rs As DAO.Recordset > >> Dim CurrentDb As Database > >> > >> Set rs = CurrentDb.OpenRecordset("qryFirst") > >> > >> rs.MoveLast 'I put this in because I've found > >> sometimes it doesn't count properly > >> otherwise... > >> > >> If rs.RecordCount = 0 Then > >> MsgBox "blah" > >> Else > >> DoCmd.OpenQuery "qryFirst", acViewNormal > >> End If > >> > >> End Sub > >> > >> Any ideas what's causing this error?
- Next message: Joe: "Link to SQL server"
- Previous message: Allen Browne: "Re: Indexing Tables"
- In reply to: sandra_at_discussions.microsoft.com: "Re: Error 91 help required"
- Next in thread: Reggie: "Re: Error 91 help required"
- Reply: Reggie: "Re: Error 91 help required"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|