We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Object Variable or with block variable not set

jitganguly
jitganguly asked
on
Medium Priority
205 Views
Last Modified: 2010-05-01
rstwo.Open "SELECT * from xyz", conn, adOpenKeyset, adLockPessimistic, adCmdText

Why ?
Comment
Watch Question

Engineer
CERTIFIED EXPERT
Commented:
Hi,

Do you have one of these:

Dim rstwo As New ADODB.RecordSet

or

Set rstwo = New ADODB.RecordSet

---
Harish

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I have this
Dim rstwo As ADODB.Recordset
Harisha M GEngineer
CERTIFIED EXPERT

Commented:
jitganguly, you may have to post the code prior to this for us to know the exact reason.

You may not have initialized conn
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Commented:
Dim rstwo As ADODB.Recordset
Set rstwo = New ADODB.RecordSet   'mgh's first comment
'Your conn code, then...
rstwo.Open "SELECT * from xyz", conn, adOpenKeyset, adLockPessimistic, adCmdText
Harisha M GEngineer
CERTIFIED EXPERT

Commented:
New ??

Author

Commented:
No done deal.
I put Set rstwo = New ADODB.RecordSet
Harisha M GEngineer
CERTIFIED EXPERT

Commented:
Have either this:

Dim rstwo As ADODB.Recordset
Set rstwo = New ADODB.RecordSet  
rstwo.Open "SELECT * from xyz", conn, adOpenKeyset, adLockPessimistic, adCmdText

or this:

Dim rstwo As New ADODB.Recordset
rstwo.Open "SELECT * from xyz", conn, adOpenKeyset, adLockPessimistic, adCmdText
Harisha M GEngineer
CERTIFIED EXPERT

Commented:
Thanks :)

Author

Commented:
I am getting current recordset does nto support updation

rstwo.Open "SELECT * from abc", conn, adOpenDynamic, adLockPessimistic, adCmdText
            If Not rstwo.EOF Then
                rstwo("Match_id") = MMMaxID + 1
                rstwo.Update
                Set rstwo = Nothing
                rs("match_id") = mmaxid + 1
                rs.Update
            End If
Harisha M GEngineer
CERTIFIED EXPERT

Commented:
jitganguly, I don't know the exact reason for this, but some of the site's PAQs point in the direction that the permissions may not be correct
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.