Re: Error 91 help required
From: Reggie (NoSpamreggie_at_NoSpamsmittysinet.com)
Date: 07/07/04
- Next message: Allen Browne: "Re: VBA - Add New Issue"
- Previous message: travis_5579_at_hotmail.com: "VBA - Add New Issue"
- In reply to: sandra_at_discussions.microsoft.com: "Error 91 help required"
- Next in thread: sandra_at_discussions.microsoft.com: "Re: Error 91 help required"
- Reply: sandra_at_discussions.microsoft.com: "Re: Error 91 help required"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 7 Jul 2004 02:52:20 -0700
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: Allen Browne: "Re: VBA - Add New Issue"
- Previous message: travis_5579_at_hotmail.com: "VBA - Add New Issue"
- In reply to: sandra_at_discussions.microsoft.com: "Error 91 help required"
- Next in thread: sandra_at_discussions.microsoft.com: "Re: Error 91 help required"
- Reply: sandra_at_discussions.microsoft.com: "Re: Error 91 help required"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|