Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

Object Variable or with block variable not set

rstwo.Open "SELECT * from xyz", conn, adOpenKeyset, adLockPessimistic, adCmdText

Why ?
0
jitganguly
Asked:
jitganguly
  • 6
  • 3
1 Solution
 
Harisha M GCommented:
Hi,

Do you have one of these:

Dim rstwo As New ADODB.RecordSet

or

Set rstwo = New ADODB.RecordSet

---
Harish
0
 
jitgangulyAuthor Commented:
I have this
Dim rstwo As ADODB.Recordset
0
 
Harisha M GCommented:
jitganguly, you may have to post the code prior to this for us to know the exact reason.

You may not have initialized conn
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
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
0
 
Harisha M GCommented:
New ??
0
 
jitgangulyAuthor Commented:
No done deal.
I put Set rstwo = New ADODB.RecordSet
0
 
Harisha M GCommented:
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
0
 
Harisha M GCommented:
Thanks :)
0
 
jitgangulyAuthor 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
0
 
Harisha M GCommented:
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
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now